
管理员
站长
- UID
- 1
- 积分
- 224394
- 余额
- 13 R
- Moe币
- 84875
- 在线时间
- 279 小时
- 注册时间
- 2025-12-28
- 最后登录
- 2026-11-3
|
|
ON_INIT:"ON_SESSION_INIT"}},22418:function(e,t,n){"use strict";if(n.d(t,{Dz:function(){return d},KG:function(){return l},Tj:function(){return u},ZK:function(){return s},f:function(){return g},lP:function(){return h},m0:function(){return f},pS:function(){return c},zY:function(){return p}}),3057==n.j)var i=n(58351);if(3057==n.j)var r=n(59207);if(3057==n.j)var o=n(42727);if(3057==n.j)var a=n(26484);var s,l,c;!function(e){e.style="style",e.size="size",e.optimize="optimize",e.hover="hover",e.generate_picture="generate_picture",e.insert="insert",e.replace="replace",e.background="background",e.fill="fill",e.copy="copy",e.download="download",e.reuse_prompt="reuse_prompt"}(s||(s={})),function(e){e.generate_begin="generate_begin",e.generate_finish="finish_page"}(l||(l={})),function(e){e.request="request"}(c||(c={}));var u="wpp_ai_generate_img_intention",p="wps_wpp_generate_picture",d=function(e){switch(e){case r.A.GenResult.fill:return s.fill;case r.A.GenResult.insert:return s.insert;case r.A.GenResult.replace:return s.replace;case r.A.GenResult.setBackground:return s.background;default:return""}};function g(){var e=(0,i.r_)(32);(0,o.setCommonDataValue)("action_id",e)}function h(e){(0,o.setCommonDataValue)("open_position",e)}var f=function(){window.collectionAI=function(e,t){var n,i,r=(null==(i=window.Extention.TaskPanelCopilot.getActiveDocumentInfo())?void 0:i.code)?i.result:{cloud_file_id:"",integrity_check_value:""},o=r.integrity_check_value,s=r.cloud_file_id,l=Object.assign(t,{comp:"wpp",ai_type:a.cq,rp:1,integritycheckvalue:o,cloud_file_id:s,icEvent:e,page_process:void 0,pre_page_name:void 0});l=Object.fromEntries(Object.entries(l).filter((function(e){e[0];var t=e[1];return null!=t}))),console.warn("window.Extention?.Report.sendInfo: ",e,l),null===(n=window.Extention)||void 0===n||n.Report.sendInfo(e,l,1)}}},83648:function(e,t,n){"use strict";n.r(t),n.d(t,{default:function(){return H}});var i=n(73379),r=n.n(i),o=n(25144),a=n.n(o),s=n(14868),l=n.n(s),c=n(52595),u=n.n(c),p=n(647),d=n.n(p),g=n(76532),h=n.n(g),f=n(84794),m={};m.styleTagTransform=h(),m.setAttributes=u(),m.insert=l().bind(null,"head"),m.domAPI=a(),m.insertStyleElement=d();r()(f.A,m),f.A&&f.A.locals&&f.A.locals;var v=n(44801),w=n(67329),y=n(32663),b=n(74357),_=n(92880),A=n(10545),E=n(96685),k=n(79964),P=n(77009),x=n(32928),T=n(95066),C=n(93026),S=n(8134),I=n(20222),N=n(42727),R=n(77560),D=n(22418),O=function(){(0,v.useEffect)((function(){var e;document.body.classList.remove("wpp-t2i-plugin"),document.body.classList.add("wpp-t2i-plugin"),null===(e=window.Extention)||void 0===e||e.Webview.pageReady();var t=function(){(0,T.A)(C.D.ON_BODY_HIDE)};return window.addEventListener("blur",t),function(){window.removeEventListener("blur",t)}}),[]),(0,v.useEffect)((function(){(0,D.m0)();var e=R.A.getEntry();N.open(e)}),[]);var e=(0,E.d7)((function(){var e=document.body.getBoundingClientRect(),t=e.width,n=e.height;P.A.dispatch((0,x.i)({bodyWidth:t,bodyHeight:n}))}),30);(0,k.A)("resize",e);(0,k.A)(C.D.ON_SESSION_INIT,(function(){R.A.requestPresetData()}));var t=(0,S.n)((function(){(0,T.A)(C.D.ON_WARPPER_SCROLL)}),30);return v.createElement("div",{className:"wpp-t2i-plugin-wrapper",onScroll:t},v.createElement(w.A,null),v.createElement(y.A,null),v.createElement(b.A,null),v.createElement(_.A,null),v.createElement(A.A,null),v.createElement(I.A,null))},H=v.memo(O)},29027:function(e,t,n){"use strict";var i=n(38667),r=n.n(i),o=n(10989),a=n.n(o),s=n(80440),l=n.n(s),c=function(e,t,n,i,r){void 0===i&&(i=!0),void 0===r&&(r=!0),this.loader=e,this.style={width:t,height:n},this.loop=i,this.autoplay=r};t.A={t2i:{genLoading1_1:new c(r(),143,143),genLoading9_16:new c(a(),143,143),genLoading4_3:new c(l(),143,143)}}},21004:function(e,t,n){"use strict";var i=n(3460),r=n(44801),o=n(52901),a=n.n(o),s=n(29027),l=n(40312),c=n.n(l),u=function(e){function t(){var t=null!==e&&e.apply(this,arguments)||this;return t.isUnmount=!1,t.animation=null,t.state={style:{width:null,height:null}},t.refDiv=r.createRef(),t}return(0,i.C6)(t,e),t.getDerivedStateFromProps=function(e,t){var n=e.config.style,i=n.width,r=n.height;return i!==t.style.width||r!==t.style.height?{style:{width:i,height:r}}:null},t.prototype.componentDidMount=function(){this.load()},t.prototype.componentWillUnmount=function(){this.isUnmount=!0,this.animation&&this.animation.destroy()},t.prototype.load=function(){var e=this,n=this.props.config;t.preload(n).then((function(t){if(!e.isUnmount){var i=t[0],r=t[1],o=n.loop,a=n.autoplay;e.animation=i.loadAnimation({loop:o,autoplay:a,container:e.refDiv.current,renderer:"svg",animationData:r})}}))},t.prototype.render=function(){var e,t=this.props,n=t.className,i=t.border,o=this.state.style,a=c()(((e={"wowui-lottie":i})["".concat(n)]=1,e));return r.createElement("div",{ref:this.refDiv,className:a,style:o})},t.Config=s.A,t.preload=function(e){var t=[new Promise((function(e){a()((function(t){return e(t)}))}))];e&&(Array.isArray(e)?e:[e]).forEach((function(e){var n=new Promise((function(t){e.loader((function(e){return t(e.default)}))}));t.push(n)}));return Promise.all(t)},t.defaultProps={border:!0},t}(r.PureComponent);t.Ay=3057==n.j?u:null},75190:function(e,t,n){"use strict";var i=n(44801);if(3057==n.j)var r=n(69248);if(3057==n.j)var o=n(3439);if(3057==n.j)var a=n(25787);if(3057==n.j)var s=n(3598);if(3057==n.j)var l=n(15851);if(3057==n.j)var c=n(37260);var u=n(59207);if(3057==n.j)var p=n(14797);var d=n(40312),g=n.n(d),h=n(36435),f=u.A.DescribeInput,m=h.e2.config.showOptimizeBtn||!1;t.A=3057==n.j?i.memo((function(e){var t=e.genState,n=void 0===t?r.w.NotBegin:t,u=e.inputCount,d=void 0===u?0:u,h=e.onDelete,v=e.handleOptPrompt,w=(0,i.useCallback)((function(){h()}),[h]),y=(0,i.useMemo)((function(){var e=i.createElement(a.A,{className:"color-icon-ai-fill"});switch(n){case r.w.NotBegin:e=i.createElement(a.A,{className:"color-icon-ai-fill"});break;case r.w.Generating:e=i.createElement(s.A,{className:"primary-fill"});break;case r.w.Done:e=i.createElement(l.A,{className:"primary-fill"})}return e}),[n]),b=(0,i.useMemo)((function(){var e=f.startOpt;switch(n){case r.w.NotBegin:e=f.startOpt;break;case r.w.Generating:e=f.stopOpt;break;case r.w.Done:e=f.undoOpt}return e}),[n]),_=n===r.w.NotBegin?f.btnTooltip:"",A=g()({"operate-btn":1,"ai-color":n===r.w.NotBegin});return i.createElement("div",{className:"t2i-input-operate"},m&&i.createElement(p.A,{title:_},i.createElement(o.A,{className:A,size:"medium",htmlType:"button",icon:y,disabled:0===d,onClick:v},b)),i.createElement("div",{className:"right"},d>=500&&i.createElement("span",{className:"input-count"},"".concat(d,"/500")),d>0&&i.createElement(p.A,{title:f.clearTooltip},i.createElement(o.A,{disabled:n===r.w.Generating,className:"close-btn",size:"medium",onClick:w,icon:i.createElement(c.A,{className:"close-fillshape-icon"})}))))})):null},69248:function(e,t,n){"use strict";var i;n.d(t,{w:function(){return i}}),function(e){e[e.NotBegin=0]="NotBegin",e[e.Generating=1]="Generating",e[e.Done=2]="Done"}(i||(i={}))},67329:function(e,t,n){"use strict";n.d(t,{A:function(){return V}});var i=n(73379),r=n.n(i),o=n(25144),a=n.n(o),s=n(14868),l=n.n(s),c=n(52595),u=n.n(c),p=n(647),d=n.n(p),g=n(76532),h=n.n(g),f=n(12979),m={};m.styleTagTransform=h(),m.setAttributes=u(),m.insert=l().bind(null,"head"),m.domAPI=a(),m.insertStyleElement=d();r()(f.A,m),f.A&&f.A.locals&&f.A.locals;var v=n(44801),w=n(51611),y=n(32928),b=n(77009),_=n(23188),A=n(59207),E=n(74031),k=n(75190),P=n(69248),x=n(77560),T=n(26484),C=n(79964),S=n(93026),I=n(95066),N=n(36435),R=n(32546),D=n(56648),O=n(75817),H=n(60313),G=n(52805),F=n(42727),B=n(22418),L=function(){var e=(0,w.d4)((function(e){return e.t2i})),t=e.inputVal,n=e.optInstrucionState,i=void 0===n?P.w.NotBegin:n,r=e.genPrompt,o=(0,v.useRef)(),a=t.length;(0,v.useEffect)((function(){H.A.reset(),H.A.intiUpdateTextAreaFunc((function(e){var t;null===(t=o.current)||void 0===t||t.setInputVal(e),b.A.dispatch((0,y.i)({optInstrucionState:P.w.NotBegin,inputVal:e}))}))}),[]);var s=(0,v.useCallback)((function(e){var t,n=e.detail,r=n.value,a=n.genPrompt,s=n.forceUpdate,l=void 0!==s&&s;(i===P.w.Generating||l)&&(b.A.dispatch((0,y.i)({inputVal:r,genPrompt:a,optInstrucionState:P.w.NotBegin})),null===(t=o.current)||void 0===t||t.setInputVal(r),H.A.onUpdateText(r))}),[i]),l=(0,v.useCallback)((function(e){var t,n=e.detail.value;if(b.A.getState().t2i.optInstrucionState===P.w.NotBegin){var i=b.A.getState().t2i.inputVal+n;i.length>500||(b.A.dispatch((0,y.i)({inputVal:i})),null===(t=o.current)||void 0===t||t.setInputVal(i),H.A.onUpdateText(i))}}),[]);(0,C.A)(S.D.UPDATE_T2I_PROMPT,s),(0,C.A)(T.up.ON_T2I_REUSE_PROMPT,(function(e){var t,n=e.detail.prompt;b.A.dispatch((0,y.i)({inputVal:n})),null===(t=o.current)||void 0===t||t.setInputVal(n),H.A.onUpdateText(n),G.A.takeSelfFocus();var i=document.querySelector(".wpp-t2i-plugin-wrapper"),r=o.current.getTextarea();i.scrollTo({top:0,behavior:"smooth"}),r.focus()})),(0,C.A)(S.D.UPDATE_T2I_INPUT_VAL,l);var c=(0,v.useCallback)((function(e){var n,i;null!=e&&((null===(n=o.current)||void 0===n?void 0:n.getCompositingStatus())||(e=e.trimStart()),e!==t&&(b.A.dispatch((0,y.i)({optInstrucionState:P.w.NotBegin,inputVal:e})),null===(i=o.current)||void 0===i||i.setInputVal(e),H.A.onUpdateText(e)))}),[t]),u=(0,v.useCallback)((function(e){var t;return(null===(t=o.current)||void 0===t?void 0:t.getCompositingStatus())||(e=e.trimStart()),e}),[]),p=(0,v.useCallback)((function(){var e;b.A.dispatch((0,y.i)({inputVal:"",optInstrucionState:P.w.NotBegin})),null===(e=o.current)||void 0===e||e.clear()}),[]),d=(0,v.useCallback)((function(){var e;if(i!==P.w.Generating){if(i===P.w.NotBegin)return F.funcClick({funcName:B.ZK.optimize}),void x.A.requestPromptOptimize({prompt:t});b.A.dispatch((0,y.i)({inputVal:r,optInstrucionState:P.w.NotBegin,genPrompt:""})),null===(e=o.current)||void 0===e||e.setInputVal(r),H.A.onUpdateText(r)}else b.A.dispatch((0,y.i)({optInstrucionState:P.w.NotBegin}))}),[i,t,r]),g=(0,v.useCallback)((function(e){e.keyCode===D.DD.ESC&&i===P.w.Generating&&((0,O.v0)(e),b.A.dispatch((0,y.i)({optInstrucionState:P.w.NotBegin})))}),[i]);(0,C.A)("keydown",g);return v.createElement(v.Fragment,null,v.createElement(_.A,{title:A.A.Title.picDiscribe}),v.createElement("div",{className:"t2i-input-wrapper",onKeyDown:function(e){var n,i,r=(0,R.Rx)(e),a=r&&e.keyCode===D.DD.Z,s=r&&e.keyCode===D.DD.Y,l=e.keyCode===D.DD.ENTER;if(a||s||l){var c=document.activeElement===(null===(n=o.current)||void 0===n?void 0:n.getTextarea());document.hasFocus()&&((0,O.v0)(e),a?H.A.undo():s&&H.A.redo(),c&&""!==t&&l&&(null===(i=o.current)||void 0===i||i.getTextarea().blur(),(0,I.A)(S.D.ON_ENTER_START_GEN)))}}},v.createElement("div",{className:"t2i-textarea-wrapper"},v.createElement(E.A,{ref:o,disabled:i===P.w.Generating,className:"t2i-textarea-ctn",placeholder:function(){var e,t=x.A.getEntry(),n=(null===(e=N.e2.config)||void 0===e?void 0:e.prompt_placeholder)||{},i=n.picture,r=void 0===i?"":i,o=n.background,a=void 0===o?"":o;return T.v6.includes(t)?a:r}(),autoHeight:!1,maxLength:500,onChange:c,innerTextChange:u})),v.createElement(k.A,{genState:i,inputCount:a,onDelete:p,handleOptPrompt:d}),v.createElement("div",{className:"t2i-ai-bottom-line"})))},V=v.memo(L)},60313:function(e,t){"use strict";var n=function(){function e(){this.undoStack=[""],this.redoStack=[],this.lastValue=""}return e.prototype.reset=function(){this.undoStack=[],this.redoStack=[],this.lastValue=""},e.prototype.intiUpdateTextAreaFunc=function(e){this.updateTextAreaFunc=e},e.prototype.onUpdateText=function(e){e!==this.lastValue&&(this.undoStack.length>20&&this.undoStack.shift(),this.undoStack.push(this.lastValue),this.redoStack=[],this.lastValue=e)},e.prototype.undo=function(){if(this.undoStack.length>0){var e=this.undoStack.pop();this.redoStack.push(this.lastValue),this.updateTextAreaFunc(e),this.lastValue=e}},e.prototype.redo=function(){if(this.redoStack.length>0){var e=this.redoStack.pop();this.undoStack.push(this.lastValue),this.updateTextAreaFunc(e),this.lastValue=e}},e}();t.A=new n},10545:function(e,t,n){"use strict";var i=n(44801),r=n(51611);if(3057==n.j)var o=n(42147);t.A=3057==n.j?i.memo((function(){var e=(0,r.d4)((function(e){return e.t2i})).imageResults;return i.createElement(o.A,{imageResults:e,isHistory:!1})})):null},20222:function(e,t,n){"use strict";n.d(t,{A:function(){return F}});var i=n(3460),r=n(73379),o=n.n(r),a=n(25144),s=n.n(a),l=n(14868),c=n.n(l),u=n(52595),p=n.n(u),d=n(647),g=n.n(d),h=n(76532),f=n.n(h),m=n(70648),v={};v.styleTagTransform=f(),v.setAttributes=p(),v.insert=c().bind(null,"head"),v.domAPI=s(),v.insertStyleElement=g();o()(m.A,v),m.A&&m.A.locals&&m.A.locals;var w=n(44801),y=n(51611),b=n(42147),_=n(59207),A=n(45839),E=n(71525),k=n(40312),P=n.n(k),x=n(77560),T=n(79964),C=n(93026),S=n(48310),I=n(14797),N=n(75817),R=n(32928),D=n(77009),O=n(24669),H="HISTORY_LOADING_ID",G=function(){var e=(0,y.d4)((function(e){return e.t2i})).historyImageResults,t=(0,w.useState)(!0),n=t[0],r=t[1],o=(0,w.useState)(!1),a=o[0],s=o[1],l=(0,w.useState)(!1),c=l[0],u=l[1],p=(0,w.useState)(!1),d=p[0],g=p[1],h=(0,w.useState)(!1),f=h[0],m=h[1],v=(0,w.useRef)(0),k=(0,w.useRef)(!1),G=(0,w.useRef)(n);(0,w.useEffect)((function(){G.current=n}),[n]);var F=function(){r(!1),L();var e=V();null==e||e.scrollTo({top:e.scrollHeight,behavior:"smooth"})},B=function(){var e=(0,i.fX)([],D.A.getState().t2i.historyImageResults,!0).filter((function(e){return e.bubble_id!==H}));0===e.length&&r(!0),D.A.dispatch((0,R.i)({historyImageResults:e})),s(!1)},L=function(){return(0,i.sH)(void 0,void 0,void 0,(function(){return(0,i.YH)(this,(function(e){return a||c||(s(!0),function(){if(!((0,i.fX)([],D.A.getState().t2i.historyImageResults,!0).length>0)){var e=[{bubble_id:H,style:"",isGen:!0,urls:Array(4).fill(""),prompt:"",width:1e3,height:1e3}];D.A.dispatch((0,R.i)({historyImageResults:e}))}}(),x.A.getHistory().then((function(e){0===e.length&&u(!0),B()})).catch((function(e){console.error(e),k.current=!0,setTimeout((function(){k.current=!1}),500),B(),G.current||window.Toast.info((0,O.h)(F),null,3,{top:15})}))),[2]}))}))},V=function(){var e;return null===(e=document.getElementsByClassName("wpp-t2i-plugin-wrapper"))||void 0===e?void 0:e[0]},W=function(){v.current>5||x.A.isShowHistory().then((function(e){v.current++;var t=e.show;e.isSuccess?m(t):W()}))};(0,w.useEffect)((function(){f||W(),f&&L()}),[f]),(0,T.A)(C.D.ON_WARPPER_SCROLL,(function(){if(!k.current&&!n){var e=V(),t=e.scrollTop,i=e.clientHeight,r=e.scrollHeight;g(t>3*i),t+i+10>r&&L()}})),(0,T.A)(C.D.ON_TASKPANEL_VISIBLE_CHANGE,(function(){r(!0),u(!1)}));var U=P()({"fold-btn":1,"is-not-fold":!n});return f||0!==e.length?w.createElement(w.Fragment,null,w.createElement("div",{className:"history-toggle-title-wrapper"},w.createElement("div",{className:"history-toggle-title",onClick:function(){return void 0===t&&(t=!1),r(!n),void((n&&0===e.length||t)&&L());var t}},w.createElement("span",{className:"title"},n?_.A.History.openHistory:_.A.History.hideHistory),w.createElement(E.A,{className:U}))),!n&&w.createElement(b.A,{imageResults:e,isHistory:!0}),!n&&!c&&e.length>4&&a&&w.createElement("div",{className:"history-load-more"},w.createElement(A.A,{className:"loading-icon"}),w.createElement("div",{className:"text"},_.A.History.load)),c&&!n&&w.createElement("div",{className:"history-load-all"},_.A.History.loadAllTip),d&&w.createElement(I.A,{title:_.A.History.toolTip},w.createElement("div",{className:"back-top-wrap",onClick:function(e){(0,N.v0)(e),V().scrollTo({top:0,behavior:"smooth"})}},w.createElement(S.A,{className:"secondary-fill",size:12})))):null},F=w.memo(G)},24669:function(e,t,n){"use strict";n.d(t,{h:function(){return s}});var i=n(44801);if(3057==n.j)var r=n(75817);if(3057==n.j)var o=n(59207);var a=function(e){var t=e.clickFunc;return i.createElement("div",{className:"t2i-history-load-tip-wrapper"},o.A.History.errorTip1,i.createElement("span",{onClick:function(e){t(),(0,r.v0)(e),window.Toast.close(!0)}},o.A.History.errorTip2))},s=function(e){return i.createElement(a,{clickFunc:e})}},49532:function(e,t,n){"use strict";n.d(t,{E:function(){return m},Z:function(){return h}});var i=n(44801),r=n(59207),o=n(38912),a=n(54622),s=n(702),l=n(33239),c=n(26058),u=n(30877),p=n(36435),d=r.A.RatioSelect,g=p.e2.config.t2iRatio||[],h={},f=function(e,t,n){h[e]={width:t,height:n}};g.forEach((function(e){var t=e.width,n=e.height;switch(e.ratioType){case d.horizontal16_9:f(d.ratio16_9,t,n);break;case d.horizontal14_3:f(d.ratio4_3,t,n);break;case d.vertical9_16:f(d.ratio9_16,t,n);break;case d.vertical3_4:f(d.ratio3_4,t,n);break;case d.square:f(d.ratio1_1,t,n)}})),h[d.suitRatio]={width:-1,height:-1};var m=g.map((function(e){var t,n,r;switch(e.ratioType){case d.horizontal16_9:t=d.ratio16_9,n=h[d.ratio16_9],r=i.createElement(o.A,{className:"primary-fill"});break;case d.horizontal14_3:t=d.ratio4_3,n=h[d.ratio4_3],r=i.createElement(c.A,{className:"primary-fill"});break;case d.vertical9_16:t=d.ratio9_16,n=h[d.ratio9_16],r=i.createElement(s.A,{className:"primary-fill"});break;case d.vertical3_4:t=d.ratio3_4,n=h[d.ratio3_4],r=i.createElement(u.A,{className:"primary-fill"});break;case d.square:t=d.ratio1_1,n=h[d.ratio1_1],r=i.createElement(a.A,{className:"primary-fill"});break;default:t="",n={},r=null}return{content:t,value:n,icon:r}}));m.push({content:d.suitRatio,value:h[d.suitRatio],icon:i.createElement(l.A,{className:"primary-fill"})})},74357:function(e,t,n){"use strict";n.d(t,{A:function(){return H}});var i=n(73379),r=n.n(i),o=n(25144),a=n.n(o),s=n(14868),l=n.n(s),c=n(52595),u=n.n(c),p=n(647),d=n.n(p),g=n(76532),h=n.n(g),f=n(21895),m={};m.styleTagTransform=h(),m.setAttributes=u(),m.insert=l().bind(null,"head"),m.domAPI=a(),m.insertStyleElement=d();r()(f.A,m),f.A&&f.A.locals&&f.A.locals;var v=n(44801),w=n(23188),y=n(59207),b=n(47599),_=n(81870),A=n(19734),E=n(49532),k=n(51611),P=n(32928),x=n(77009),T=n(14797),C=n(79964),S=n(93026),I=n(42727),N=n(22418),R=n(34134),D=n(38778),O=function(){var e=(0,v.useState)(!1),t=e[0],n=e[1],i=(0,v.useState)(-1),r=i[0],o=i[1],a=(0,k.d4)((function(e){return e.t2i})),s=a.curRatio,l=a.isSelectPic,c=a.bodyWidth,u=a.bodyHeight,p=(0,v.useRef)(null),d=(0,v.useCallback)((function(e){s!==e&&x.A.dispatch((0,P.i)({curRatio:e})),I.funcClick({funcName:N.ZK.size,extParams:{content_detail:JSON.stringify({original_size:s,new_size:e})}}),n(!1)}),[s]),g=(0,v.useCallback)((function(){t&&n(!1)}),[t]);(0,R.A)(g,D.Go.Text2Img),(0,C.A)(S.D.ON_WARPPER_SCROLL,g),(0,C.A)(S.D.ON_BODY_HIDE,g),(0,v.useEffect)((function(){var e,t,n=null===(t=null===(e=p.current)||void 0===e?void 0:e.getElementsByTagName("button"))||void 0===t?void 0:t[0];if(n){var i=n.getBoundingClientRect(),r=i.top,a=i.height,s=u-10-r-a,l=r-10;o(s>226?226:s>l?s:l)}}),[c,u,t]);var h=(0,v.useMemo)((function(){return v.createElement(A.A,{selectable:!0,className:"t2i-ratio-panel",style:{width:c-38,height:r}},E.E.map((function(e,t){var n=e.icon,i=e.content,r=s===i,o=i===y.A.RatioSelect.suitRatio,a=!!o&&!l,c="";return o&&!l&&(c=y.A.RatioSelect.suitTooltip),v.createElement(T.A,{title:c,key:t,placement:"top"},v.createElement(A.A.Item,{icon:n,selected:r,disabled:a,className:"t2i-ratio-item",onClick:function(){return d(i)}},r&&v.createElement(_.A,{className:"selected-icon"}),i))})))}),[s,l,d,c,r]),f=E.E.find((function(e){return e.content===s}));return v.createElement("div",{className:"ratio-select-wraper",ref:p},v.createElement(w.A,{title:y.A.Title.ratio}),v.createElement(b.A.Button,{panel:h,visible:t,className:"ratio-select-panel-button",onVisibleChange:function(e){n(e),e||I.funcClick({funcName:N.ZK.size,extParams:{content_detail:JSON.stringify({original_size:s,new_size:s})}})},panelClassName:"ratio-select-panel"},null==f?void 0:f.icon,null==f?void 0:f.content))},H=v.memo(O)},68365:function(e,t,n){"use strict";var i=n(44801);if(3057==n.j)var r=n(14797);if(3057==n.j)var o=n(59207);if(3057==n.j)var a=n(79964);if(3057==n.j)var s=n(93026);t.A=3057==n.j?i.memo((function(){var e=(0,i.useRef)(null);return(0,a.A)(s.D.ON_WARPPER_SCROLL,(function(){var t;null===(t=e.current)||void 0===t||t.close()})),i.createElement(r.A,{title:o.A.GenResult.brokenTip,ref:e,placement:"top"},i.createElement("div",{className:"gen-failed-placeholder"},i.createElement("div",{className:"broken-image"})))})):null},64213:function(e,t,n){"use strict";n.d(t,{W:function(){return o},r:function(){return a}});var i=88,r={};function o(e){return new Promise((function(t,n){r[e]?(console.log("urlToBase64 use cache"),t(r[e])):fetch(e).then((function(e){return e.blob()})).then((function(n){var i=new FileReader;i.readAsDataURL(n),i.onloadend=function(){r[e]=i.result,console.log("urlToBase64 not use cache"),t(i.result)}})).catch(n)}))}function a(e,t,n,r){var o,a=e.target;if("IMG"!==(null==a?void 0:a.tagName)&&(a=null==a?void 0:a.children[0]),!(a=(null==a?void 0:a.closest("img"))||a))return{left:-1,top:-1,width:-1,height:-1,imgHeight:-1,imgWidth:-1};var s=r.includes("image_gallery"),l=a.getBoundingClientRect().top,c=a.naturalWidth,u=a.naturalHeight,p=null===(o=window.Extention.Webview.getParentGeometry())||void 0===o?void 0:o.result,d=p.x,g=p.y,h=p.w,f=g+p.h-10,m=window.screen.availHeight,v=Math.min(512,m-128),w=c+32;c>352?w=352:c<332&&(w=332);var y=c/u,b=Math.min(w/y,v)+i,_=d-10-w;_<0&&(_=d+h+10);var A=g+l;return A+b>f&&(A=f-b),A=Math.max(0,A),console.log("getPreviewPosition",w,b,_,A,n,t),{left:_,top:A,width:w,height:b,imgHeight:u,imgWidth:c,isFromGallery:s}}},42147:function(e,t,n){"use strict";if(3057==n.j)var i=n(3460);n(12835);var r=n(44801),o=n(51611);if(3057==n.j)var a=n(59207);if(3057==n.j)var s=n(77560);if(3057==n.j)var l=n(52805);if(3057==n.j)var c=n(26484);if(3057==n.j)var u=n(64213);if(3057==n.j)var p=n(32928);if(3057==n.j)var d=n(77009);if(3057==n.j)var g=n(79964);if(3057==n.j)var h=n(96685);var f,m=n(40312),v=n.n(m);if(3057==n.j)var w=n(75817);if(3057==n.j)var y=n(29027);if(3057==n.j)var b=n(21004);if(3057==n.j)var _=n(74508);if(3057==n.j)var A=n(26805);if(3057==n.j)var E=n(93026);if(3057==n.j)var k=n(68365);if(3057==n.j)var P=n(42727);if(3057==n.j)var x=n(22418);if(3057==n.j)var T=n(76806);!function(e){e.copyPicture="copyPicture",e.downPicture="downPicture"}(f||(f={}));t.A=3057==n.j?r.memo((function(e){var t=e.imageResults,n=e.isHistory,m=(0,o.d4)((function(e){return e.t2i})),C=m.isSelectPic,S=m.isFill,I=(0,r.useRef)(null),N=(0,r.useRef)(null),R=(0,r.useRef)(null),D=(0,r.useState)(""),O=D[0],H=D[1],G=(0,r.useState)(a.A.GenResult.insert),F=G[0],B=G[1],L=(0,r.useRef)(!1);(0,r.useEffect)((function(){return function(){clearTimeout(I.current)}}),[]),(0,r.useEffect)((function(){B(S?a.A.GenResult.fill:C?a.A.GenResult.replace:a.A.GenResult.insert)}),[C,S]);var V=(0,r.useMemo)((function(){var e=[];return t.forEach((function(t){var n=t.prompt,i=t.urls,r=t.width,o=t.height,a=t.style,s=t.isGen,l=t.bubble_id,c=t.failCount,u=t.isSuitRatio,p=function(e,t){var n=e/t;return n=n>1?9/16:1===n?1:4/3};i.forEach((function(t){var c=p(r,o);e.push({prompt:n,width:r,height:o,style:a,url:t.url,isGen:s,ratio:c,isSuitRatio:u,genFrom:t.genFrom,bubble_id:l,is_optimize:t.is_optimize,originUrl:t.originUrl,urls:i})}));var d=c>0?Array(c).fill({prompt:n,width:r,height:o,style:a,ratio:p(r,o),bubble_id:l,isFailed:!0}):[];e.push.apply(e,d)})),e}),[t]),W=(0,r.useCallback)((function(e){e.detail.isHover?clearTimeout(I.current):I.current=setTimeout((function(){l.A.hidePreview()}),300)}),[I]);(0,g.A)(c.up.ON_WPP_T2IPREVIEW_HOVER,W);var U=function(e){return(0,i.sH)(void 0,void 0,void 0,(function(){return(0,i.YH)(this,(function(t){switch(t.label){case 0:if(e.startsWith("data:"))return[3,4];t.label=1;case 1:return t.trys.push([1,3,,4]),[4,(0,u.W)(e)];case 2:return e=t.sent(),[3,4];case 3:return t.sent(),console.error("urlToBase64 fail"),[2,""];case 4:return[2,e.split(",")[1]]}}))}))},j=function(e,t,n,r){return(0,i.sH)(void 0,void 0,void 0,(function(){var o,l,c,u,p,d,g,h,f,m,v,w,y,b,_,A;return(0,i.YH)(this,(function(i){switch(i.label){case 0:return o=e.url,l=e.style,c=e.isSuitRatio,u=e.width,p=e.height,d=e.originUrl,g=e.is_optimize,h=e.urls,[4,U(o)];case 1:return(f=i.sent())?(m=h.map((function(e){return e.originUrl})),v=m.filter((function(e){return e.includes("image_gallery")})).length,w=m.length-v,y={style:l,generate_mode:g?a.A.GenResult.withTheme:a.A.GenResult.notWithTheme,is_suit_ratio:!!c,size:{width:u,height:p},picture_id:d},b=Object.assign({},y,{ai_picture_count:w,gallery_picture_count:v,picture_count:m.length}),_=JSON.stringify(y),A=JSON.stringify(b),P.funcClick({funcName:t,extParams:{content_detail:_,track_id:P.getCommonData().track_id,action_id:P.getCommonData().action_id,request_source:x.pS.request,function_code:x.Tj,page_name:x.KG.generate_finish}}),P.resultUse({pageName:x.KG.generate_finish,extParams:{track_id:P.getCommonData().track_id,action_id:P.getCommonData().action_id,intention_code:x.zY,function_code:x.Tj,answer_use:t,content_detail:A,ai_picture_count:w,gallery_picture_count:v,picture_count:m.length}}),r?(clearTimeout(R.current),R.current=setTimeout((function(){s.A[n]({data:f})}),10)):s.A[n]({data:f}),[2]):[2]}}))}))},z=function(e){j(e,x.ZK.copy,f.copyPicture)},M=function(e){j(e,x.ZK.download,f.downPicture,!0)},q=function(e){return(0,i.sH)(void 0,void 0,void 0,(function(){var t,n,r,o,c,u,g,h,f,m,v,y,b,_,A,E,k,T,C,I;return(0,i.YH)(this,(function(i){switch(i.label){case 0:return t=e.url,n=e.e,r=e.isSetBackGround,o=void 0!==r&&r,c=e.style,u=e.isSuitRatio,g=e.width,h=e.height,f=e.originUrl,m=e.is_optimize,v=e.urls,t?((0,w.v0)(n),l.A.takePreviewFocus(),[4,U(t)]):[2];case 1:return(y=i.sent())?(b=o?x.ZK.background:(0,x.Dz)(F),_=v.map((function(e){return e.originUrl})),A=_.filter((function(e){return e.includes("image_gallery")})).length,E=_.length-A,k={style:c,generate_mode:m?a.A.GenResult.withTheme:a.A.GenResult.notWithTheme,is_suit_ratio:!!u,size:{width:g,height:h},picture_id:f},T=Object.assign({},k,{ai_picture_count:E,gallery_picture_count:A,picture_count:_.length}),C=JSON.stringify(k),I=JSON.stringify(T),P.funcClick({funcName:b,extParams:{content_detail:C,track_id:P.getCommonData().track_id,action_id:P.getCommonData().action_id,request_source:x.pS.request,function_code:x.Tj,page_name:x.KG.generate_finish}}),P.resultUse({pageName:x.KG.generate_finish,extParams:{track_id:P.getCommonData().track_id,action_id:P.getCommonData().action_id,intention_code:x.zY,function_code:x.Tj,answer_use:b,content_detail:I}}),s.A.insertPicture({data:y,type:o?"setBackGround":""}),S&&d.A.dispatch((0,p.i)({isFill:!1})),[2]):[2]}}))}))},Y=function(){T.Ue&&(L.current=!1),clearTimeout(I.current),clearTimeout(N.current),I.current=setTimeout((function(){l.A.hidePreview()}),300)},K=function(){l.A.hidePreview()},Q=function(e,t){H(e?t:"")},X=function(){H("")},Z=(0,h._g)((function(){l.A.takeSelfFocus()}),200);return(0,g.A)(E.D.ON_BODY_HIDE,X),(0,g.A)(E.D.ON_WARPPER_SCROLL,X),(0,g.A)(E.D.ON_PREVIEW_FOCUS_CHANGED,(function(){T.Ue&&L.current&&Z()})),0===t.length?null:r.createElement("div",{className:"gen-results-wrapper"},r.createElement("div",{className:"gen-item-wrapper"},V.map((function(e,t){var o,s=e.url,c=e.isGen,p=e.ratio,d=e.style,g=e.prompt,h=e.width,f=e.height,m=e.bubble_id,w=e.isFailed,E=e.is_optimize,C=e.originUrl,S=e.isSuitRatio,R=e.urls,D=e.genFrom,H=v()(((o={"gen-item":1,"is-gen":c})["gen-item-".concat(m)]=1,o)),G=v()({"gen-skeleton-wrapper":1,"is-history":n}),B=c&&function(e){return e>1?y.A.t2i.genLoading4_3:1===e?y.A.t2i.genLoading1_1:y.A.t2i.genLoading9_16}(p)||null,V={style:d,prompt:g,url:s,width:h,height:f,isGen:c,isFailed:w,ratio:p,originUrl:C,is_optimize:E,isSuitRatio:S,urls:R,genFrom:D};return r.createElement("div",{className:H,key:t,style:{"--aspect-ratio":p},onClick:function(e){q((0,i.Cl)((0,i.Cl)({},V),{e:e}))},onMouseDown:K,onMouseLeave:Y,onMouseEnter:function(e){!function(e){(0,i.sH)(void 0,void 0,void 0,(function(){var t,n,r,o,s,c,p,d,g,h,f,m;return(0,i.YH)(this,(function(i){return T.Ue&&(L.current=!0),t=e.style,n=e.prompt,r=e.url,o=e.e,s=e.width,c=e.height,p=e.isGen,d=e.isFailed,g=e.is_optimize,h=e.originUrl,f=e.isSuitRatio,m=e.genFrom,p||d||(clearTimeout(I.current),clearTimeout(N.current),N.current=setTimeout((function(){var e=(0,u.r)(o,s,c,h),i=e.width,p=e.height,d=e.left,v=e.top,w=e.imgHeight,y=e.imgWidth,b=e.isFromGallery;if(-1!==v&&-1!==d){var _={width:i,height:p,left:d,top:v,style:t,prompt:n,url:r,imgHeight:w,imgWidth:y,is_optimize:g,originUrl:h,isFromGallery:b,genFrom:m};l.A.updatePreviewInfo(_),P.funcClick({funcName:x.ZK.hover,extParams:{content_detail:JSON.stringify({style:t,generate_mode:g?a.A.GenResult.withTheme:a.A.GenResult.notWithTheme,is_suit_ratio:!!f,size:{width:s,height:c},picture_id:h}),track_id:P.getCommonData().track_id,action_id:P.getCommonData().action_id,request_source:x.pS.request,function_code:x.Tj,page_name:x.KG.generate_finish}})}}),200)),[2]}))}))}((0,i.Cl)((0,i.Cl)({},V),{e:e}))}},s&&r.createElement("div",{className:"gen-img-wrapper"},r.createElement("img",{src:s})),c&&r.createElement("div",{className:G},n&&r.createElement("div",{className:"diagonal-stripe"}),!n&&r.createElement(r.Fragment,null,r.createElement(_.A,{className:"gen-image-icon"}),r.createElement(b.Ay,{key:m+t,config:B,className:"t2i-gen-loading"}))),w&&r.createElement(k.A,null),!c&&!w&&r.createElement(A.A,{key:C,url:s,extParams:V,activeItem:O,insertText:F,insertFunc:q,downPicFunc:M,copyPicFunc:z,onVisibleChange:Q}))}))))})):null},26805:function(e,t,n){"use strict";if(3057==n.j)var i=n(3460);n(12835);var r=n(44801);if(3057==n.j)var o=n(47599);if(3057==n.j)var a=n(75398);if(3057==n.j)var s=n(41814);if(3057==n.j)var l=n(72138);if(3057==n.j)var c=n(35979);if(3057==n.j)var u=n(66711);if(3057==n.j)var p=n(37336);if(3057==n.j)var d=n(59207);var g=n(40312),h=n.n(g);if(3057==n.j)var f=n(75817);if(3057==n.j)var m=n(26484);if(3057==n.j)var v=n(76806);t.A=3057==n.j?r.memo((function(e){var t=e.url,n=e.insertText,g=e.insertFunc,w=e.activeItem,y=e.onVisibleChange,b=e.copyPicFunc,_=e.downPicFunc,A=e.extParams,E=(0,r.useCallback)((function(e){var n;y(e,t),v.Ue&&(null===(n=window.Extention)||void 0===n||n.Common.Event.dispatchEvent(m.up.ON_OPTIONS_PANEL_VISIBLE_CHANGE,!1,{visible:e}))}),[t,y]),k=function(e){y(!1,t),(0,f.v0)(e)},P=function(e){k(e),b((0,i.Cl)((0,i.Cl)({},A),{url:t}))},x=function(e){k(e),_((0,i.Cl)((0,i.Cl)({},A),{url:t}))},T=function(e){k(e),g((0,i.Cl)((0,i.Cl)({},A),{url:t,e:e,isSetBackGround:!0}))},C=(0,r.useMemo)((function(){return r.createElement(a.A,{className:"t2i-more-panel"},r.createElement(a.A.Item,{onClick:P},r.createElement(l.A,{className:"copy"}),d.A.PictureOptions.copy),r.createElement(a.A.Item,{onClick:x},r.createElement(c.A,{className:"download"}),d.A.PictureOptions.download),r.createElement(a.A.Item,{onClick:T},r.createElement(u.A, |
|