aitu-app 0.5.14
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/.DS_Store +0 -0
- package/README.md +47 -0
- package/_headers +84 -0
- package/_redirects +2 -0
- package/assets/ChatMessagesArea-CkUX81uB.js +251 -0
- package/assets/ChatMessagesArea-Di0Z80Zh.css +1 -0
- package/assets/KaTeX_AMS-Regular-BQhdFMY1.woff2 +0 -0
- package/assets/KaTeX_AMS-Regular-DMm9YOAa.woff +0 -0
- package/assets/KaTeX_AMS-Regular-DRggAlZN.ttf +0 -0
- package/assets/KaTeX_Caligraphic-Bold-ATXxdsX0.ttf +0 -0
- package/assets/KaTeX_Caligraphic-Bold-BEiXGLvX.woff +0 -0
- package/assets/KaTeX_Caligraphic-Bold-Dq_IR9rO.woff2 +0 -0
- package/assets/KaTeX_Caligraphic-Regular-CTRA-rTL.woff +0 -0
- package/assets/KaTeX_Caligraphic-Regular-Di6jR-x-.woff2 +0 -0
- package/assets/KaTeX_Caligraphic-Regular-wX97UBjC.ttf +0 -0
- package/assets/KaTeX_Fraktur-Bold-BdnERNNW.ttf +0 -0
- package/assets/KaTeX_Fraktur-Bold-BsDP51OF.woff +0 -0
- package/assets/KaTeX_Fraktur-Bold-CL6g_b3V.woff2 +0 -0
- package/assets/KaTeX_Fraktur-Regular-CB_wures.ttf +0 -0
- package/assets/KaTeX_Fraktur-Regular-CTYiF6lA.woff2 +0 -0
- package/assets/KaTeX_Fraktur-Regular-Dxdc4cR9.woff +0 -0
- package/assets/KaTeX_Main-Bold-Cx986IdX.woff2 +0 -0
- package/assets/KaTeX_Main-Bold-Jm3AIy58.woff +0 -0
- package/assets/KaTeX_Main-Bold-waoOVXN0.ttf +0 -0
- package/assets/KaTeX_Main-BoldItalic-DxDJ3AOS.woff2 +0 -0
- package/assets/KaTeX_Main-BoldItalic-DzxPMmG6.ttf +0 -0
- package/assets/KaTeX_Main-BoldItalic-SpSLRI95.woff +0 -0
- package/assets/KaTeX_Main-Italic-3WenGoN9.ttf +0 -0
- package/assets/KaTeX_Main-Italic-BMLOBm91.woff +0 -0
- package/assets/KaTeX_Main-Italic-NWA7e6Wa.woff2 +0 -0
- package/assets/KaTeX_Main-Regular-B22Nviop.woff2 +0 -0
- package/assets/KaTeX_Main-Regular-Dr94JaBh.woff +0 -0
- package/assets/KaTeX_Main-Regular-ypZvNtVU.ttf +0 -0
- package/assets/KaTeX_Math-BoldItalic-B3XSjfu4.ttf +0 -0
- package/assets/KaTeX_Math-BoldItalic-CZnvNsCZ.woff2 +0 -0
- package/assets/KaTeX_Math-BoldItalic-iY-2wyZ7.woff +0 -0
- package/assets/KaTeX_Math-Italic-DA0__PXp.woff +0 -0
- package/assets/KaTeX_Math-Italic-flOr_0UB.ttf +0 -0
- package/assets/KaTeX_Math-Italic-t53AETM-.woff2 +0 -0
- package/assets/KaTeX_SansSerif-Bold-CFMepnvq.ttf +0 -0
- package/assets/KaTeX_SansSerif-Bold-D1sUS0GD.woff2 +0 -0
- package/assets/KaTeX_SansSerif-Bold-DbIhKOiC.woff +0 -0
- package/assets/KaTeX_SansSerif-Italic-C3H0VqGB.woff2 +0 -0
- package/assets/KaTeX_SansSerif-Italic-DN2j7dab.woff +0 -0
- package/assets/KaTeX_SansSerif-Italic-YYjJ1zSn.ttf +0 -0
- package/assets/KaTeX_SansSerif-Regular-BNo7hRIc.ttf +0 -0
- package/assets/KaTeX_SansSerif-Regular-CS6fqUqJ.woff +0 -0
- package/assets/KaTeX_SansSerif-Regular-DDBCnlJ7.woff2 +0 -0
- package/assets/KaTeX_Script-Regular-C5JkGWo-.ttf +0 -0
- package/assets/KaTeX_Script-Regular-D3wIWfF6.woff2 +0 -0
- package/assets/KaTeX_Script-Regular-D5yQViql.woff +0 -0
- package/assets/KaTeX_Size1-Regular-C195tn64.woff +0 -0
- package/assets/KaTeX_Size1-Regular-Dbsnue_I.ttf +0 -0
- package/assets/KaTeX_Size1-Regular-mCD8mA8B.woff2 +0 -0
- package/assets/KaTeX_Size2-Regular-B7gKUWhC.ttf +0 -0
- package/assets/KaTeX_Size2-Regular-Dy4dx90m.woff2 +0 -0
- package/assets/KaTeX_Size2-Regular-oD1tc_U0.woff +0 -0
- package/assets/KaTeX_Size3-Regular-CTq5MqoE.woff +0 -0
- package/assets/KaTeX_Size3-Regular-DgpXs0kz.ttf +0 -0
- package/assets/KaTeX_Size4-Regular-BF-4gkZK.woff +0 -0
- package/assets/KaTeX_Size4-Regular-DWFBv043.ttf +0 -0
- package/assets/KaTeX_Size4-Regular-Dl5lxZxV.woff2 +0 -0
- package/assets/KaTeX_Typewriter-Regular-C0xS9mPB.woff +0 -0
- package/assets/KaTeX_Typewriter-Regular-CO6r4hn1.woff2 +0 -0
- package/assets/KaTeX_Typewriter-Regular-D3Ib7_Hf.ttf +0 -0
- package/assets/Tableau10-B-NsZVaP.js +1 -0
- package/assets/Tableau10-Dnlau_Wv.js +1 -0
- package/assets/ToolboxDrawer-By1XMh8B.js +87 -0
- package/assets/ToolboxDrawer-fPqvDLQE.css +1 -0
- package/assets/__vite-browser-external-BIHI7g3E.js +1 -0
- package/assets/ai-analyze-Db-iXol6.js +1 -0
- package/assets/arc-BZXVqUcI.js +1 -0
- package/assets/arc-ajYHRRnk.js +1 -0
- package/assets/array-B5oSNiGi.js +1 -0
- package/assets/array-BKyUJesY.js +1 -0
- package/assets/batch-image-generation-Baqb01Lm.js +6 -0
- package/assets/batch-image-generation-CbLMWmjk.css +1 -0
- package/assets/blockDiagram-38ab4fdb-BT3H_WVv.js +118 -0
- package/assets/blockDiagram-38ab4fdb-u0xYP3Lt.js +118 -0
- package/assets/c4Diagram-3d4e48cf-CBvM6zjM.js +10 -0
- package/assets/c4Diagram-3d4e48cf-WOIEVidH.js +10 -0
- package/assets/channel-BP25wTsw.js +1 -0
- package/assets/channel-HzrLNFUg.js +1 -0
- package/assets/classDiagram-70f12bd4-BMutcvFi.js +2 -0
- package/assets/classDiagram-70f12bd4-Cl9U1r5F.js +2 -0
- package/assets/classDiagram-v2-f2320105-C0agtbR4.js +2 -0
- package/assets/classDiagram-v2-f2320105-tCBzATK6.js +2 -0
- package/assets/clone-B69pF7Y_.js +1 -0
- package/assets/clone-oX7o-l4R.js +1 -0
- package/assets/createText-2e5e7dd3-CZ9_fscE.js +5 -0
- package/assets/createText-2e5e7dd3-idrqgJjU.js +7 -0
- package/assets/edges-e0da2a9e-C-RyePMV.js +4 -0
- package/assets/edges-e0da2a9e-DJXAjJSL.js +4 -0
- package/assets/erDiagram-9861fffd-DWJR_3zL.js +51 -0
- package/assets/erDiagram-9861fffd-x2Kcy95-.js +51 -0
- package/assets/flowDb-956e92f1-BgKjOIdz.js +10 -0
- package/assets/flowDb-956e92f1-CF6y18Tn.js +10 -0
- package/assets/flowDiagram-66a62f08-BPPw0wPU.js +4 -0
- package/assets/flowDiagram-66a62f08-CSAllSFf.js +4 -0
- package/assets/flowDiagram-v2-96b9c2cf-B-UGyXRi.js +1 -0
- package/assets/flowDiagram-v2-96b9c2cf-Cm596kxZ.js +1 -0
- package/assets/flowchart-elk-definition-4a651766-9XSRJbsr.js +139 -0
- package/assets/flowchart-elk-definition-4a651766-DWFN9DN3.js +139 -0
- package/assets/ganttDiagram-c361ad54-D9tbz9tQ.js +257 -0
- package/assets/ganttDiagram-c361ad54-ot5pUYpT.js +257 -0
- package/assets/gitGraphDiagram-72cf32ee-BFV3Mt8C.js +70 -0
- package/assets/gitGraphDiagram-72cf32ee-C6qFzgGh.js +70 -0
- package/assets/graph-BxwlF7JS.js +1 -0
- package/assets/graph-D-2Ldvxg.js +1 -0
- package/assets/grid-image-cM9AmYC8.js +1 -0
- package/assets/has-CgdIPiQG.js +1 -0
- package/assets/hasIn-4iY02rGN.js +1 -0
- package/assets/index-3862675e-CVZnpwDN.js +1 -0
- package/assets/index-3862675e-DqdI9cab.js +1 -0
- package/assets/index-B2dvADz8.css +1 -0
- package/assets/index-BicRPzXC.js +1 -0
- package/assets/index-Bs7-jmv6.css +1 -0
- package/assets/index-BwSGXyRr.js +99 -0
- package/assets/index-C1XdOOAn.css +1 -0
- package/assets/index-C4AKKbpQ.css +1 -0
- package/assets/index-CkpXFt8n.js +1 -0
- package/assets/index-CrxF9gFe.js +42 -0
- package/assets/index-DBWqXBIQ.js +93 -0
- package/assets/index-DI_5V2-m.js +3 -0
- package/assets/index-DWUAFoZG.js +2064 -0
- package/assets/index-Dn0YtZ2R.js +3 -0
- package/assets/index-e05Rs4M6.js +12 -0
- package/assets/index.dom-C3-224fz.js +1 -0
- package/assets/infoDiagram-f8f76790-CnrpwoOt.js +7 -0
- package/assets/infoDiagram-f8f76790-FKC1Sy9Y.js +7 -0
- package/assets/init-A0kIFD9x.js +1 -0
- package/assets/init-Gi6I4Gst.js +1 -0
- package/assets/inspiration-board-B_-BBBHt.js +1 -0
- package/assets/isEmpty-Dj2GV0v-.js +1 -0
- package/assets/journeyDiagram-49397b02-B7fP21sU.js +139 -0
- package/assets/journeyDiagram-49397b02-Dp3X9XWq.js +139 -0
- package/assets/katex-BbEIqZs1.js +261 -0
- package/assets/katex-Cu_Erd72.js +261 -0
- package/assets/layout-BD3yCK_X.js +1 -0
- package/assets/layout-DHHYqX7p.js +1 -0
- package/assets/line-B3bNrkzn.js +1 -0
- package/assets/line-B86HLuqu.js +1 -0
- package/assets/linear-DU2Ciymb.js +1 -0
- package/assets/linear-wCAlMhOS.js +1 -0
- package/assets/mermaid.core-DfVvnpgz.js +91 -0
- package/assets/mindmap-definition-fc14e90a-D1sxE3xG.js +425 -0
- package/assets/mindmap-definition-fc14e90a-YuSOJC7P.js +425 -0
- package/assets/ordinal-BRr1uYdk.js +1 -0
- package/assets/ordinal-Cboi1Yqb.js +1 -0
- package/assets/path-CY0bYimO.js +1 -0
- package/assets/path-CbwjOpE9.js +1 -0
- package/assets/photo-wall-splitter-BVU2e0aS.js +1 -0
- package/assets/pick-Cvlwra4g.js +1 -0
- package/assets/pieDiagram-8a3498a8-B6mJUqro.js +35 -0
- package/assets/pieDiagram-8a3498a8-B91bWgo_.js +35 -0
- package/assets/quadrantDiagram-120e2f19-BxS8fQEz.js +7 -0
- package/assets/quadrantDiagram-120e2f19-DwudONqx.js +7 -0
- package/assets/requirementDiagram-deff3bca-DygaMIoy.js +52 -0
- package/assets/requirementDiagram-deff3bca-v9xlgfS8.js +52 -0
- package/assets/sankeyDiagram-04a897e0-BV23dp4l.js +8 -0
- package/assets/sankeyDiagram-04a897e0-BXCiXiyw.js +8 -0
- package/assets/sequenceDiagram-704730f1-CObRpNi4.js +122 -0
- package/assets/sequenceDiagram-704730f1-Ck69A6wI.js +122 -0
- package/assets/settings-dialog-BlCO49C4.js +1 -0
- package/assets/settings-dialog-QUxXj54T.css +1 -0
- package/assets/stateDiagram-587899a1-J_G6I0oo.js +1 -0
- package/assets/stateDiagram-587899a1-z-tKclr3.js +1 -0
- package/assets/stateDiagram-v2-d93cdb3a-DsThtOzP.js +1 -0
- package/assets/stateDiagram-v2-d93cdb3a-XIvq5t8a.js +1 -0
- package/assets/styles-6aaf32cf-1fjuNMUk.js +207 -0
- package/assets/styles-6aaf32cf-DT2rVNfQ.js +207 -0
- package/assets/styles-9a916d00-fLeUSina.js +160 -0
- package/assets/styles-9a916d00-q64Umkis.js +160 -0
- package/assets/styles-c10674c1-BWlxVc3Q.js +116 -0
- package/assets/styles-c10674c1-CtYpjMYU.js +116 -0
- package/assets/svgDrawCommon-08f97a94-C_DhKfny.js +1 -0
- package/assets/svgDrawCommon-08f97a94-DSBqmUv2.js +1 -0
- package/assets/timeline-definition-85554ec2-AKpzwLPN.js +61 -0
- package/assets/timeline-definition-85554ec2-dTkYwoLF.js +61 -0
- package/assets/ttd-dialog-CxiaIUuJ.js +47 -0
- package/assets/ttd-dialog-DCapefb6.css +1 -0
- package/assets/upload-4sxUU7q_.js +1 -0
- package/assets/video-recovery-service-BckHbSyK.js +1 -0
- package/assets/web-vitals-DcvjKPr-.js +1 -0
- package/assets/winbox.bundle.min-CoRPjCs5.js +1 -0
- package/assets/xlsx-CkFp8p6R.js +105 -0
- package/assets/xychartDiagram-e933f94c-DCmvL0ag.js +7 -0
- package/assets/xychartDiagram-e933f94c-aqOiXp_u.js +7 -0
- package/batch-image.html +1616 -0
- package/favicon.ico +0 -0
- package/icons/README.md +55 -0
- package/icons/aitu10.png +0 -0
- package/icons/android-chrome-192x192.png +0 -0
- package/icons/android-chrome-512x512.png +0 -0
- package/icons/apple-touch-icon.png +0 -0
- package/icons/favicon-16x16.png +0 -0
- package/icons/favicon-16x16.svg +539 -0
- package/icons/favicon-32x32.png +0 -0
- package/icons/favicon-32x32.svg +539 -0
- package/icons/favicon-new.svg +539 -0
- package/icons/favicon-new.svg.png +0 -0
- package/icons/icon-192x192.svg +539 -0
- package/icons/icon-512x512.svg +539 -0
- package/icons/icon-96x96.png +0 -0
- package/icons/icon-96x96.svg +539 -0
- package/iframe-test.html +340 -0
- package/index.html +105 -0
- package/init.json +6 -0
- package/logo/cardid.jpg +0 -0
- package/logo/group-qr.png +0 -0
- package/logo/logo_drawnix_h.svg +539 -0
- package/logo/logo_drawnix_h_dark.svg +539 -0
- package/logo/logo_drawnix_new.svg +539 -0
- package/manifest.json +52 -0
- package/package.json +31 -0
- package/product_showcase/aitu-01.png +0 -0
- package/product_showcase/aitu-02.png +0 -0
- package/product_showcase/aitu-03.png +0 -0
- package/product_showcase/aitu-04.png +0 -0
- package/product_showcase/aitu-05.png +0 -0
- package/product_showcase/aitu-06.png +0 -0
- package/product_showcase/case-1.png +0 -0
- package/product_showcase/case-2.png +0 -0
- package/robots.txt +13 -0
- package/sitemap.xml +29 -0
- package/sw-debug/app.js +3069 -0
- package/sw-debug/console-entry.js +80 -0
- package/sw-debug/log-entry.js +452 -0
- package/sw-debug/log-panel.js +309 -0
- package/sw-debug/postmessage-entry.js +117 -0
- package/sw-debug/status-panel.js +125 -0
- package/sw-debug/styles.css +2103 -0
- package/sw-debug/sw-communication.js +208 -0
- package/sw-debug/utils.js +112 -0
- package/sw-debug.html +685 -0
- package/sw.js +58 -0
- package/version.json +10 -0
|
@@ -0,0 +1,116 @@
|
|
|
1
|
+
import{G as R}from"./graph-D-2Ldvxg.js";import{a9 as G,aa as F,ab as U,ac as W,ad as j,a7 as H,l as g,g as S,d as $,u as K,_ as X,$ as A,a0 as E,a1 as L,W as z,k as P,v as J}from"./mermaid.core-DfVvnpgz.js";import{r as Q}from"./index-3862675e-CVZnpwDN.js";import{c as Y}from"./channel-HzrLNFUg.js";function Z(e){return typeof e=="string"?new G([document.querySelectorAll(e)],[document.documentElement]):new G([U(e)],F)}function pe(e,l){return!!e.children(l).length}function be(e){return N(e.v)+":"+N(e.w)+":"+N(e.name)}var O=/:/g;function N(e){return e?String(e).replace(O,"\\:"):""}function ee(e,l){l&&e.attr("style",l)}function fe(e,l,c){l&&e.attr("class",l).attr("class",c+" "+e.attr("class"))}function ue(e,l){var c=l.graph();if(W(c)){var a=c.transition;if(j(a))return a(e)}return e}function te(e,l){var c=e.append("foreignObject").attr("width","100000"),a=c.append("xhtml:div");a.attr("xmlns","http://www.w3.org/1999/xhtml");var i=l.label;switch(typeof i){case"function":a.insert(i);break;case"object":a.insert(function(){return i});break;default:a.html(i)}ee(a,l.labelStyle),a.style("display","inline-block"),a.style("white-space","nowrap");var d=a.node().getBoundingClientRect();return c.attr("width",d.width).attr("height",d.height),c}const V={},re=function(e){const l=Object.keys(e);for(const c of l)V[c]=e[c]},q=async function(e,l,c,a,i,d){const u=a.select(`[id="${c}"]`),n=Object.keys(e);for(const p of n){const r=e[p];let y="default";r.classes.length>0&&(y=r.classes.join(" ")),y=y+" flowchart-label";const w=A(r.styles);let t=r.text!==void 0?r.text:r.id,s;if(g.info("vertex",r,r.labelType),r.labelType==="markdown")g.info("vertex",r,r.labelType);else if(J(S().flowchart.htmlLabels))s=te(u,{label:t}).node(),s.parentNode.removeChild(s);else{const k=i.createElementNS("http://www.w3.org/2000/svg","text");k.setAttribute("style",w.labelStyle.replace("color:","fill:"));const _=t.split(P.lineBreakRegex);for(const C of _){const v=i.createElementNS("http://www.w3.org/2000/svg","tspan");v.setAttributeNS("http://www.w3.org/XML/1998/namespace","xml:space","preserve"),v.setAttribute("dy","1em"),v.setAttribute("x","1"),v.textContent=C,k.appendChild(v)}s=k}let b=0,o="";switch(r.type){case"round":b=5,o="rect";break;case"square":o="rect";break;case"diamond":o="question";break;case"hexagon":o="hexagon";break;case"odd":o="rect_left_inv_arrow";break;case"lean_right":o="lean_right";break;case"lean_left":o="lean_left";break;case"trapezoid":o="trapezoid";break;case"inv_trapezoid":o="inv_trapezoid";break;case"odd_right":o="rect_left_inv_arrow";break;case"circle":o="circle";break;case"ellipse":o="ellipse";break;case"stadium":o="stadium";break;case"subroutine":o="subroutine";break;case"cylinder":o="cylinder";break;case"group":o="rect";break;case"doublecircle":o="doublecircle";break;default:o="rect"}const T=await z(t,S());l.setNode(r.id,{labelStyle:w.labelStyle,shape:o,labelText:T,labelType:r.labelType,rx:b,ry:b,class:y,style:w.style,id:r.id,link:r.link,linkTarget:r.linkTarget,tooltip:d.db.getTooltip(r.id)||"",domId:d.db.lookUpDomId(r.id),haveCallback:r.haveCallback,width:r.type==="group"?500:void 0,dir:r.dir,type:r.type,props:r.props,padding:S().flowchart.padding}),g.info("setNode",{labelStyle:w.labelStyle,labelType:r.labelType,shape:o,labelText:T,rx:b,ry:b,class:y,style:w.style,id:r.id,domId:d.db.lookUpDomId(r.id),width:r.type==="group"?500:void 0,type:r.type,dir:r.dir,props:r.props,padding:S().flowchart.padding})}},M=async function(e,l,c){g.info("abc78 edges = ",e);let a=0,i={},d,u;if(e.defaultStyle!==void 0){const n=A(e.defaultStyle);d=n.style,u=n.labelStyle}for(const n of e){a++;const p="L-"+n.start+"-"+n.end;i[p]===void 0?(i[p]=0,g.info("abc78 new entry",p,i[p])):(i[p]++,g.info("abc78 new entry",p,i[p]));let r=p+"-"+i[p];g.info("abc78 new link id to be used is",p,r,i[p]);const y="LS-"+n.start,w="LE-"+n.end,t={style:"",labelStyle:""};switch(t.minlen=n.length||1,n.type==="arrow_open"?t.arrowhead="none":t.arrowhead="normal",t.arrowTypeStart="arrow_open",t.arrowTypeEnd="arrow_open",n.type){case"double_arrow_cross":t.arrowTypeStart="arrow_cross";case"arrow_cross":t.arrowTypeEnd="arrow_cross";break;case"double_arrow_point":t.arrowTypeStart="arrow_point";case"arrow_point":t.arrowTypeEnd="arrow_point";break;case"double_arrow_circle":t.arrowTypeStart="arrow_circle";case"arrow_circle":t.arrowTypeEnd="arrow_circle";break}let s="",b="";switch(n.stroke){case"normal":s="fill:none;",d!==void 0&&(s=d),u!==void 0&&(b=u),t.thickness="normal",t.pattern="solid";break;case"dotted":t.thickness="normal",t.pattern="dotted",t.style="fill:none;stroke-width:2px;stroke-dasharray:3;";break;case"thick":t.thickness="thick",t.pattern="solid",t.style="stroke-width: 3.5px;fill:none;";break;case"invisible":t.thickness="invisible",t.pattern="solid",t.style="stroke-width: 0;fill:none;";break}if(n.style!==void 0){const o=A(n.style);s=o.style,b=o.labelStyle}t.style=t.style+=s,t.labelStyle=t.labelStyle+=b,n.interpolate!==void 0?t.curve=E(n.interpolate,L):e.defaultInterpolate!==void 0?t.curve=E(e.defaultInterpolate,L):t.curve=E(V.curve,L),n.text===void 0?n.style!==void 0&&(t.arrowheadStyle="fill: #333"):(t.arrowheadStyle="fill: #333",t.labelpos="c"),t.labelType=n.labelType,t.label=await z(n.text.replace(P.lineBreakRegex,`
|
|
2
|
+
`),S()),n.style===void 0&&(t.style=t.style||"stroke: #333; stroke-width: 1.5px;fill:none;"),t.labelStyle=t.labelStyle.replace("color:","fill:"),t.id=r,t.classes="flowchart-link "+y+" "+w,l.setEdge(n.start,n.end,t,a)}},le=function(e,l){return l.db.getClasses()},ae=async function(e,l,c,a){g.info("Drawing flowchart");let i=a.db.getDirection();i===void 0&&(i="TD");const{securityLevel:d,flowchart:u}=S(),n=u.nodeSpacing||50,p=u.rankSpacing||50;let r;d==="sandbox"&&(r=$("#i"+l));const y=d==="sandbox"?$(r.nodes()[0].contentDocument.body):$("body"),w=d==="sandbox"?r.nodes()[0].contentDocument:document,t=new R({multigraph:!0,compound:!0}).setGraph({rankdir:i,nodesep:n,ranksep:p,marginx:0,marginy:0}).setDefaultEdgeLabel(function(){return{}});let s;const b=a.db.getSubGraphs();g.info("Subgraphs - ",b);for(let f=b.length-1;f>=0;f--)s=b[f],g.info("Subgraph - ",s),a.db.addVertex(s.id,{text:s.title,type:s.labelType},"group",void 0,s.classes,s.dir);const o=a.db.getVertices(),T=a.db.getEdges();g.info("Edges",T);let k=0;for(k=b.length-1;k>=0;k--){s=b[k],Z("cluster").append("text");for(let f=0;f<s.nodes.length;f++)g.info("Setting up subgraphs",s.nodes[f],s.id),t.setParent(s.nodes[f],s.id)}await q(o,t,l,y,w,a),await M(T,t);const _=y.select(`[id="${l}"]`),C=y.select("#"+l+" g");if(await Q(C,t,["point","circle","cross"],"flowchart",l),K.insertTitle(_,"flowchartTitleText",u.titleTopMargin,a.db.getDiagramTitle()),X(t,_,u.diagramPadding,u.useMaxWidth),a.db.indexNodes("subGraph"+k),!u.htmlLabels){const f=w.querySelectorAll('[id="'+l+'"] .edgeLabel .label');for(const x of f){const m=x.getBBox(),h=w.createElementNS("http://www.w3.org/2000/svg","rect");h.setAttribute("rx",0),h.setAttribute("ry",0),h.setAttribute("width",m.width),h.setAttribute("height",m.height),x.insertBefore(h,x.firstChild)}}Object.keys(o).forEach(function(f){const x=o[f];if(x.link){const m=$("#"+l+' [id="'+f+'"]');if(m){const h=w.createElementNS("http://www.w3.org/2000/svg","a");h.setAttributeNS("http://www.w3.org/2000/svg","class",x.classes.join(" ")),h.setAttributeNS("http://www.w3.org/2000/svg","href",x.link),h.setAttributeNS("http://www.w3.org/2000/svg","rel","noopener"),d==="sandbox"?h.setAttributeNS("http://www.w3.org/2000/svg","target","_top"):x.linkTarget&&h.setAttributeNS("http://www.w3.org/2000/svg","target",x.linkTarget);const B=m.insert(function(){return h},":first-child"),I=m.select(".label-container");I&&B.append(function(){return I.node()});const D=m.select(".label");D&&B.append(function(){return D.node()})}}})},we={setConf:re,addVertices:q,addEdges:M,getClasses:le,draw:ae},oe=(e,l)=>{const c=Y,a=c(e,"r"),i=c(e,"g"),d=c(e,"b");return H(a,i,d,l)},ne=e=>`.label {
|
|
3
|
+
font-family: ${e.fontFamily};
|
|
4
|
+
color: ${e.nodeTextColor||e.textColor};
|
|
5
|
+
}
|
|
6
|
+
.cluster-label text {
|
|
7
|
+
fill: ${e.titleColor};
|
|
8
|
+
}
|
|
9
|
+
.cluster-label span,p {
|
|
10
|
+
color: ${e.titleColor};
|
|
11
|
+
}
|
|
12
|
+
|
|
13
|
+
.label text,span,p {
|
|
14
|
+
fill: ${e.nodeTextColor||e.textColor};
|
|
15
|
+
color: ${e.nodeTextColor||e.textColor};
|
|
16
|
+
}
|
|
17
|
+
|
|
18
|
+
.node rect,
|
|
19
|
+
.node circle,
|
|
20
|
+
.node ellipse,
|
|
21
|
+
.node polygon,
|
|
22
|
+
.node path {
|
|
23
|
+
fill: ${e.mainBkg};
|
|
24
|
+
stroke: ${e.nodeBorder};
|
|
25
|
+
stroke-width: 1px;
|
|
26
|
+
}
|
|
27
|
+
.flowchart-label text {
|
|
28
|
+
text-anchor: middle;
|
|
29
|
+
}
|
|
30
|
+
// .flowchart-label .text-outer-tspan {
|
|
31
|
+
// text-anchor: middle;
|
|
32
|
+
// }
|
|
33
|
+
// .flowchart-label .text-inner-tspan {
|
|
34
|
+
// text-anchor: start;
|
|
35
|
+
// }
|
|
36
|
+
|
|
37
|
+
.node .katex path {
|
|
38
|
+
fill: #000;
|
|
39
|
+
stroke: #000;
|
|
40
|
+
stroke-width: 1px;
|
|
41
|
+
}
|
|
42
|
+
|
|
43
|
+
.node .label {
|
|
44
|
+
text-align: center;
|
|
45
|
+
}
|
|
46
|
+
.node.clickable {
|
|
47
|
+
cursor: pointer;
|
|
48
|
+
}
|
|
49
|
+
|
|
50
|
+
.arrowheadPath {
|
|
51
|
+
fill: ${e.arrowheadColor};
|
|
52
|
+
}
|
|
53
|
+
|
|
54
|
+
.edgePath .path {
|
|
55
|
+
stroke: ${e.lineColor};
|
|
56
|
+
stroke-width: 2.0px;
|
|
57
|
+
}
|
|
58
|
+
|
|
59
|
+
.flowchart-link {
|
|
60
|
+
stroke: ${e.lineColor};
|
|
61
|
+
fill: none;
|
|
62
|
+
}
|
|
63
|
+
|
|
64
|
+
.edgeLabel {
|
|
65
|
+
background-color: ${e.edgeLabelBackground};
|
|
66
|
+
rect {
|
|
67
|
+
opacity: 0.5;
|
|
68
|
+
background-color: ${e.edgeLabelBackground};
|
|
69
|
+
fill: ${e.edgeLabelBackground};
|
|
70
|
+
}
|
|
71
|
+
text-align: center;
|
|
72
|
+
}
|
|
73
|
+
|
|
74
|
+
/* For html labels only */
|
|
75
|
+
.labelBkg {
|
|
76
|
+
background-color: ${oe(e.edgeLabelBackground,.5)};
|
|
77
|
+
// background-color:
|
|
78
|
+
}
|
|
79
|
+
|
|
80
|
+
.cluster rect {
|
|
81
|
+
fill: ${e.clusterBkg};
|
|
82
|
+
stroke: ${e.clusterBorder};
|
|
83
|
+
stroke-width: 1px;
|
|
84
|
+
}
|
|
85
|
+
|
|
86
|
+
.cluster text {
|
|
87
|
+
fill: ${e.titleColor};
|
|
88
|
+
}
|
|
89
|
+
|
|
90
|
+
.cluster span,p {
|
|
91
|
+
color: ${e.titleColor};
|
|
92
|
+
}
|
|
93
|
+
/* .cluster div {
|
|
94
|
+
color: ${e.titleColor};
|
|
95
|
+
} */
|
|
96
|
+
|
|
97
|
+
div.mermaidTooltip {
|
|
98
|
+
position: absolute;
|
|
99
|
+
text-align: center;
|
|
100
|
+
max-width: 200px;
|
|
101
|
+
padding: 2px;
|
|
102
|
+
font-family: ${e.fontFamily};
|
|
103
|
+
font-size: 12px;
|
|
104
|
+
background: ${e.tertiaryColor};
|
|
105
|
+
border: 1px solid ${e.border2};
|
|
106
|
+
border-radius: 2px;
|
|
107
|
+
pointer-events: none;
|
|
108
|
+
z-index: 100;
|
|
109
|
+
}
|
|
110
|
+
|
|
111
|
+
.flowchartTitleText {
|
|
112
|
+
text-anchor: middle;
|
|
113
|
+
font-size: 18px;
|
|
114
|
+
fill: ${e.textColor};
|
|
115
|
+
}
|
|
116
|
+
`,he=ne;export{we as a,ee as b,te as c,ue as d,be as e,he as f,fe as g,pe as i,Z as s};
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
import{n as o,j as i}from"./index-BwSGXyRr.js";const l=(s,t)=>{const e=s.append("rect");if(e.attr("x",t.x),e.attr("y",t.y),e.attr("fill",t.fill),e.attr("stroke",t.stroke),e.attr("width",t.width),e.attr("height",t.height),t.name&&e.attr("name",t.name),t.rx!==void 0&&e.attr("rx",t.rx),t.ry!==void 0&&e.attr("ry",t.ry),t.attrs!==void 0)for(const r in t.attrs)e.attr(r,t.attrs[r]);return t.class!==void 0&&e.attr("class",t.class),e},x=(s,t)=>{const e={x:t.startx,y:t.starty,width:t.stopx-t.startx,height:t.stopy-t.starty,fill:t.fill,stroke:t.stroke,class:"rect"};l(s,e).lower()},d=(s,t)=>{const e=t.text.replace(o," "),r=s.append("text");r.attr("x",t.x),r.attr("y",t.y),r.attr("class","legend"),r.style("text-anchor",t.anchor),t.class!==void 0&&r.attr("class",t.class);const n=r.append("tspan");return n.attr("x",t.x+t.textMargin*2),n.text(e),r},h=(s,t,e,r)=>{const n=s.append("image");n.attr("x",t),n.attr("y",e);const a=i.sanitizeUrl(r);n.attr("xlink:href",a)},y=(s,t,e,r)=>{const n=s.append("use");n.attr("x",t),n.attr("y",e);const a=i.sanitizeUrl(r);n.attr("xlink:href",`#${a}`)},p=()=>({x:0,y:0,width:100,height:100,fill:"#EDF2AE",stroke:"#666",anchor:"start",rx:0,ry:0}),g=()=>({x:0,y:0,width:100,height:100,"text-anchor":"start",style:"#666",textMargin:0,rx:0,ry:0,tspan:!0});export{x as a,g as b,y as c,l as d,h as e,d as f,p as g};
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
import{n as o,j as i}from"./mermaid.core-DfVvnpgz.js";const l=(s,t)=>{const e=s.append("rect");if(e.attr("x",t.x),e.attr("y",t.y),e.attr("fill",t.fill),e.attr("stroke",t.stroke),e.attr("width",t.width),e.attr("height",t.height),t.name&&e.attr("name",t.name),t.rx!==void 0&&e.attr("rx",t.rx),t.ry!==void 0&&e.attr("ry",t.ry),t.attrs!==void 0)for(const r in t.attrs)e.attr(r,t.attrs[r]);return t.class!==void 0&&e.attr("class",t.class),e},x=(s,t)=>{const e={x:t.startx,y:t.starty,width:t.stopx-t.startx,height:t.stopy-t.starty,fill:t.fill,stroke:t.stroke,class:"rect"};l(s,e).lower()},d=(s,t)=>{const e=t.text.replace(o," "),r=s.append("text");r.attr("x",t.x),r.attr("y",t.y),r.attr("class","legend"),r.style("text-anchor",t.anchor),t.class!==void 0&&r.attr("class",t.class);const n=r.append("tspan");return n.attr("x",t.x+t.textMargin*2),n.text(e),r},h=(s,t,e,r)=>{const n=s.append("image");n.attr("x",t),n.attr("y",e);const a=i.sanitizeUrl(r);n.attr("xlink:href",a)},y=(s,t,e,r)=>{const n=s.append("use");n.attr("x",t),n.attr("y",e);const a=i.sanitizeUrl(r);n.attr("xlink:href",`#${a}`)},p=()=>({x:0,y:0,width:100,height:100,fill:"#EDF2AE",stroke:"#666",anchor:"start",rx:0,ry:0}),g=()=>({x:0,y:0,width:100,height:100,"text-anchor":"start",style:"#666",textMargin:0,rx:0,ry:0,tspan:!0});export{x as a,g as b,y as c,l as d,h as e,d as f,p as g};
|
|
@@ -0,0 +1,61 @@
|
|
|
1
|
+
import{a3 as gt,a4 as ft,a5 as mt,g as xt,l as E,d as G,_ as _t,a6 as bt,r as kt}from"./mermaid.core-DfVvnpgz.js";import{a as D}from"./arc-BZXVqUcI.js";import"./index-DWUAFoZG.js";import"./path-CY0bYimO.js";var K=(function(){var n=function(f,i,r,c){for(r=r||{},c=f.length;c--;r[f[c]]=i);return r},t=[6,8,10,11,12,14,16,17,20,21],e=[1,9],a=[1,10],s=[1,11],h=[1,12],l=[1,13],p=[1,16],y=[1,17],g={trace:function(){},yy:{},symbols_:{error:2,start:3,timeline:4,document:5,EOF:6,line:7,SPACE:8,statement:9,NEWLINE:10,title:11,acc_title:12,acc_title_value:13,acc_descr:14,acc_descr_value:15,acc_descr_multiline_value:16,section:17,period_statement:18,event_statement:19,period:20,event:21,$accept:0,$end:1},terminals_:{2:"error",4:"timeline",6:"EOF",8:"SPACE",10:"NEWLINE",11:"title",12:"acc_title",13:"acc_title_value",14:"acc_descr",15:"acc_descr_value",16:"acc_descr_multiline_value",17:"section",20:"period",21:"event"},productions_:[0,[3,3],[5,0],[5,2],[7,2],[7,1],[7,1],[7,1],[9,1],[9,2],[9,2],[9,1],[9,1],[9,1],[9,1],[18,1],[19,1]],performAction:function(i,r,c,d,u,o,$){var x=o.length-1;switch(u){case 1:return o[x-1];case 2:this.$=[];break;case 3:o[x-1].push(o[x]),this.$=o[x-1];break;case 4:case 5:this.$=o[x];break;case 6:case 7:this.$=[];break;case 8:d.getCommonDb().setDiagramTitle(o[x].substr(6)),this.$=o[x].substr(6);break;case 9:this.$=o[x].trim(),d.getCommonDb().setAccTitle(this.$);break;case 10:case 11:this.$=o[x].trim(),d.getCommonDb().setAccDescription(this.$);break;case 12:d.addSection(o[x].substr(8)),this.$=o[x].substr(8);break;case 15:d.addTask(o[x],0,""),this.$=o[x];break;case 16:d.addEvent(o[x].substr(2)),this.$=o[x];break}},table:[{3:1,4:[1,2]},{1:[3]},n(t,[2,2],{5:3}),{6:[1,4],7:5,8:[1,6],9:7,10:[1,8],11:e,12:a,14:s,16:h,17:l,18:14,19:15,20:p,21:y},n(t,[2,7],{1:[2,1]}),n(t,[2,3]),{9:18,11:e,12:a,14:s,16:h,17:l,18:14,19:15,20:p,21:y},n(t,[2,5]),n(t,[2,6]),n(t,[2,8]),{13:[1,19]},{15:[1,20]},n(t,[2,11]),n(t,[2,12]),n(t,[2,13]),n(t,[2,14]),n(t,[2,15]),n(t,[2,16]),n(t,[2,4]),n(t,[2,9]),n(t,[2,10])],defaultActions:{},parseError:function(i,r){if(r.recoverable)this.trace(i);else{var c=new Error(i);throw c.hash=r,c}},parse:function(i){var r=this,c=[0],d=[],u=[null],o=[],$=this.table,x="",T=0,W=0,C=2,A=1,B=o.slice.call(arguments,1),k=Object.create(this.lexer),w={yy:{}};for(var v in this.yy)Object.prototype.hasOwnProperty.call(this.yy,v)&&(w.yy[v]=this.yy[v]);k.setInput(i,w.yy),w.yy.lexer=k,w.yy.parser=this,typeof k.yylloc>"u"&&(k.yylloc={});var I=k.yylloc;o.push(I);var H=k.options&&k.options.ranges;typeof w.yy.parseError=="function"?this.parseError=w.yy.parseError:this.parseError=Object.getPrototypeOf(this).parseError;function z(){var M;return M=d.pop()||k.lex()||A,typeof M!="number"&&(M instanceof Array&&(d=M,M=d.pop()),M=r.symbols_[M]||M),M}for(var b,L,S,Z,R={},O,N,Y,j;;){if(L=c[c.length-1],this.defaultActions[L]?S=this.defaultActions[L]:((b===null||typeof b>"u")&&(b=z()),S=$[L]&&$[L][b]),typeof S>"u"||!S.length||!S[0]){var J="";j=[];for(O in $[L])this.terminals_[O]&&O>C&&j.push("'"+this.terminals_[O]+"'");k.showPosition?J="Parse error on line "+(T+1)+`:
|
|
2
|
+
`+k.showPosition()+`
|
|
3
|
+
Expecting `+j.join(", ")+", got '"+(this.terminals_[b]||b)+"'":J="Parse error on line "+(T+1)+": Unexpected "+(b==A?"end of input":"'"+(this.terminals_[b]||b)+"'"),this.parseError(J,{text:k.match,token:this.terminals_[b]||b,line:k.yylineno,loc:I,expected:j})}if(S[0]instanceof Array&&S.length>1)throw new Error("Parse Error: multiple actions possible at state: "+L+", token: "+b);switch(S[0]){case 1:c.push(b),u.push(k.yytext),o.push(k.yylloc),c.push(S[1]),b=null,W=k.yyleng,x=k.yytext,T=k.yylineno,I=k.yylloc;break;case 2:if(N=this.productions_[S[1]][1],R.$=u[u.length-N],R._$={first_line:o[o.length-(N||1)].first_line,last_line:o[o.length-1].last_line,first_column:o[o.length-(N||1)].first_column,last_column:o[o.length-1].last_column},H&&(R._$.range=[o[o.length-(N||1)].range[0],o[o.length-1].range[1]]),Z=this.performAction.apply(R,[x,W,T,w.yy,S[1],u,o].concat(B)),typeof Z<"u")return Z;N&&(c=c.slice(0,-1*N*2),u=u.slice(0,-1*N),o=o.slice(0,-1*N)),c.push(this.productions_[S[1]][0]),u.push(R.$),o.push(R._$),Y=$[c[c.length-2]][c[c.length-1]],c.push(Y);break;case 3:return!0}}return!0}},_=(function(){var f={EOF:1,parseError:function(r,c){if(this.yy.parser)this.yy.parser.parseError(r,c);else throw new Error(r)},setInput:function(i,r){return this.yy=r||this.yy||{},this._input=i,this._more=this._backtrack=this.done=!1,this.yylineno=this.yyleng=0,this.yytext=this.matched=this.match="",this.conditionStack=["INITIAL"],this.yylloc={first_line:1,first_column:0,last_line:1,last_column:0},this.options.ranges&&(this.yylloc.range=[0,0]),this.offset=0,this},input:function(){var i=this._input[0];this.yytext+=i,this.yyleng++,this.offset++,this.match+=i,this.matched+=i;var r=i.match(/(?:\r\n?|\n).*/g);return r?(this.yylineno++,this.yylloc.last_line++):this.yylloc.last_column++,this.options.ranges&&this.yylloc.range[1]++,this._input=this._input.slice(1),i},unput:function(i){var r=i.length,c=i.split(/(?:\r\n?|\n)/g);this._input=i+this._input,this.yytext=this.yytext.substr(0,this.yytext.length-r),this.offset-=r;var d=this.match.split(/(?:\r\n?|\n)/g);this.match=this.match.substr(0,this.match.length-1),this.matched=this.matched.substr(0,this.matched.length-1),c.length-1&&(this.yylineno-=c.length-1);var u=this.yylloc.range;return this.yylloc={first_line:this.yylloc.first_line,last_line:this.yylineno+1,first_column:this.yylloc.first_column,last_column:c?(c.length===d.length?this.yylloc.first_column:0)+d[d.length-c.length].length-c[0].length:this.yylloc.first_column-r},this.options.ranges&&(this.yylloc.range=[u[0],u[0]+this.yyleng-r]),this.yyleng=this.yytext.length,this},more:function(){return this._more=!0,this},reject:function(){if(this.options.backtrack_lexer)this._backtrack=!0;else return this.parseError("Lexical error on line "+(this.yylineno+1)+`. You can only invoke reject() in the lexer when the lexer is of the backtracking persuasion (options.backtrack_lexer = true).
|
|
4
|
+
`+this.showPosition(),{text:"",token:null,line:this.yylineno});return this},less:function(i){this.unput(this.match.slice(i))},pastInput:function(){var i=this.matched.substr(0,this.matched.length-this.match.length);return(i.length>20?"...":"")+i.substr(-20).replace(/\n/g,"")},upcomingInput:function(){var i=this.match;return i.length<20&&(i+=this._input.substr(0,20-i.length)),(i.substr(0,20)+(i.length>20?"...":"")).replace(/\n/g,"")},showPosition:function(){var i=this.pastInput(),r=new Array(i.length+1).join("-");return i+this.upcomingInput()+`
|
|
5
|
+
`+r+"^"},test_match:function(i,r){var c,d,u;if(this.options.backtrack_lexer&&(u={yylineno:this.yylineno,yylloc:{first_line:this.yylloc.first_line,last_line:this.last_line,first_column:this.yylloc.first_column,last_column:this.yylloc.last_column},yytext:this.yytext,match:this.match,matches:this.matches,matched:this.matched,yyleng:this.yyleng,offset:this.offset,_more:this._more,_input:this._input,yy:this.yy,conditionStack:this.conditionStack.slice(0),done:this.done},this.options.ranges&&(u.yylloc.range=this.yylloc.range.slice(0))),d=i[0].match(/(?:\r\n?|\n).*/g),d&&(this.yylineno+=d.length),this.yylloc={first_line:this.yylloc.last_line,last_line:this.yylineno+1,first_column:this.yylloc.last_column,last_column:d?d[d.length-1].length-d[d.length-1].match(/\r?\n?/)[0].length:this.yylloc.last_column+i[0].length},this.yytext+=i[0],this.match+=i[0],this.matches=i,this.yyleng=this.yytext.length,this.options.ranges&&(this.yylloc.range=[this.offset,this.offset+=this.yyleng]),this._more=!1,this._backtrack=!1,this._input=this._input.slice(i[0].length),this.matched+=i[0],c=this.performAction.call(this,this.yy,this,r,this.conditionStack[this.conditionStack.length-1]),this.done&&this._input&&(this.done=!1),c)return c;if(this._backtrack){for(var o in u)this[o]=u[o];return!1}return!1},next:function(){if(this.done)return this.EOF;this._input||(this.done=!0);var i,r,c,d;this._more||(this.yytext="",this.match="");for(var u=this._currentRules(),o=0;o<u.length;o++)if(c=this._input.match(this.rules[u[o]]),c&&(!r||c[0].length>r[0].length)){if(r=c,d=o,this.options.backtrack_lexer){if(i=this.test_match(c,u[o]),i!==!1)return i;if(this._backtrack){r=!1;continue}else return!1}else if(!this.options.flex)break}return r?(i=this.test_match(r,u[d]),i!==!1?i:!1):this._input===""?this.EOF:this.parseError("Lexical error on line "+(this.yylineno+1)+`. Unrecognized text.
|
|
6
|
+
`+this.showPosition(),{text:"",token:null,line:this.yylineno})},lex:function(){var r=this.next();return r||this.lex()},begin:function(r){this.conditionStack.push(r)},popState:function(){var r=this.conditionStack.length-1;return r>0?this.conditionStack.pop():this.conditionStack[0]},_currentRules:function(){return this.conditionStack.length&&this.conditionStack[this.conditionStack.length-1]?this.conditions[this.conditionStack[this.conditionStack.length-1]].rules:this.conditions.INITIAL.rules},topState:function(r){return r=this.conditionStack.length-1-Math.abs(r||0),r>=0?this.conditionStack[r]:"INITIAL"},pushState:function(r){this.begin(r)},stateStackSize:function(){return this.conditionStack.length},options:{"case-insensitive":!0},performAction:function(r,c,d,u){switch(d){case 0:break;case 1:break;case 2:return 10;case 3:break;case 4:break;case 5:return 4;case 6:return 11;case 7:return this.begin("acc_title"),12;case 8:return this.popState(),"acc_title_value";case 9:return this.begin("acc_descr"),14;case 10:return this.popState(),"acc_descr_value";case 11:this.begin("acc_descr_multiline");break;case 12:this.popState();break;case 13:return"acc_descr_multiline_value";case 14:return 17;case 15:return 21;case 16:return 20;case 17:return 6;case 18:return"INVALID"}},rules:[/^(?:%(?!\{)[^\n]*)/i,/^(?:[^\}]%%[^\n]*)/i,/^(?:[\n]+)/i,/^(?:\s+)/i,/^(?:#[^\n]*)/i,/^(?:timeline\b)/i,/^(?:title\s[^#\n;]+)/i,/^(?:accTitle\s*:\s*)/i,/^(?:(?!\n||)*[^\n]*)/i,/^(?:accDescr\s*:\s*)/i,/^(?:(?!\n||)*[^\n]*)/i,/^(?:accDescr\s*\{\s*)/i,/^(?:[\}])/i,/^(?:[^\}]*)/i,/^(?:section\s[^#:\n;]+)/i,/^(?::\s[^#:\n;]+)/i,/^(?:[^#:\n;]+)/i,/^(?:$)/i,/^(?:.)/i],conditions:{acc_descr_multiline:{rules:[12,13],inclusive:!1},acc_descr:{rules:[10],inclusive:!1},acc_title:{rules:[8],inclusive:!1},INITIAL:{rules:[0,1,2,3,4,5,6,7,9,11,14,15,16,17,18],inclusive:!0}}};return f})();g.lexer=_;function m(){this.yy={}}return m.prototype=g,g.Parser=m,new m})();K.parser=K;const vt=K;let F="",st=0;const Q=[],q=[],V=[],it=()=>bt,rt=function(){Q.length=0,q.length=0,F="",V.length=0,kt()},at=function(n){F=n,Q.push(n)},lt=function(){return Q},ot=function(){let n=tt();const t=100;let e=0;for(;!n&&e<t;)n=tt(),e++;return q.push(...V),q},ct=function(n,t,e){const a={id:st++,section:F,type:F,task:n,score:t||0,events:e?[e]:[]};V.push(a)},ht=function(n){V.find(e=>e.id===st-1).events.push(n)},dt=function(n){const t={section:F,type:F,description:n,task:n,classes:[]};q.push(t)},tt=function(){const n=function(e){return V[e].processed};let t=!0;for(const[e,a]of V.entries())n(e),t=t&&a.processed;return t},wt={clear:rt,getCommonDb:it,addSection:at,getSections:lt,getTasks:ot,addTask:ct,addTaskOrg:dt,addEvent:ht},St=Object.freeze(Object.defineProperty({__proto__:null,addEvent:ht,addSection:at,addTask:ct,addTaskOrg:dt,clear:rt,default:wt,getCommonDb:it,getSections:lt,getTasks:ot},Symbol.toStringTag,{value:"Module"})),Et=12,U=function(n,t){const e=n.append("rect");return e.attr("x",t.x),e.attr("y",t.y),e.attr("fill",t.fill),e.attr("stroke",t.stroke),e.attr("width",t.width),e.attr("height",t.height),e.attr("rx",t.rx),e.attr("ry",t.ry),t.class!==void 0&&e.attr("class",t.class),e},Tt=function(n,t){const a=n.append("circle").attr("cx",t.cx).attr("cy",t.cy).attr("class","face").attr("r",15).attr("stroke-width",2).attr("overflow","visible"),s=n.append("g");s.append("circle").attr("cx",t.cx-15/3).attr("cy",t.cy-15/3).attr("r",1.5).attr("stroke-width",2).attr("fill","#666").attr("stroke","#666"),s.append("circle").attr("cx",t.cx+15/3).attr("cy",t.cy-15/3).attr("r",1.5).attr("stroke-width",2).attr("fill","#666").attr("stroke","#666");function h(y){const g=D().startAngle(Math.PI/2).endAngle(3*(Math.PI/2)).innerRadius(7.5).outerRadius(6.8181818181818175);y.append("path").attr("class","mouth").attr("d",g).attr("transform","translate("+t.cx+","+(t.cy+2)+")")}function l(y){const g=D().startAngle(3*Math.PI/2).endAngle(5*(Math.PI/2)).innerRadius(7.5).outerRadius(6.8181818181818175);y.append("path").attr("class","mouth").attr("d",g).attr("transform","translate("+t.cx+","+(t.cy+7)+")")}function p(y){y.append("line").attr("class","mouth").attr("stroke",2).attr("x1",t.cx-5).attr("y1",t.cy+7).attr("x2",t.cx+5).attr("y2",t.cy+7).attr("class","mouth").attr("stroke-width","1px").attr("stroke","#666")}return t.score>3?h(s):t.score<3?l(s):p(s),a},It=function(n,t){const e=n.append("circle");return e.attr("cx",t.cx),e.attr("cy",t.cy),e.attr("class","actor-"+t.pos),e.attr("fill",t.fill),e.attr("stroke",t.stroke),e.attr("r",t.r),e.class!==void 0&&e.attr("class",e.class),t.title!==void 0&&e.append("title").text(t.title),e},ut=function(n,t){const e=t.text.replace(/<br\s*\/?>/gi," "),a=n.append("text");a.attr("x",t.x),a.attr("y",t.y),a.attr("class","legend"),a.style("text-anchor",t.anchor),t.class!==void 0&&a.attr("class",t.class);const s=a.append("tspan");return s.attr("x",t.x+t.textMargin*2),s.text(e),a},$t=function(n,t){function e(s,h,l,p,y){return s+","+h+" "+(s+l)+","+h+" "+(s+l)+","+(h+p-y)+" "+(s+l-y*1.2)+","+(h+p)+" "+s+","+(h+p)}const a=n.append("polygon");a.attr("points",e(t.x,t.y,50,20,7)),a.attr("class","labelBox"),t.y=t.y+t.labelMargin,t.x=t.x+.5*t.labelMargin,ut(n,t)},Nt=function(n,t,e){const a=n.append("g"),s=X();s.x=t.x,s.y=t.y,s.fill=t.fill,s.width=e.width,s.height=e.height,s.class="journey-section section-type-"+t.num,s.rx=3,s.ry=3,U(a,s),pt(e)(t.text,a,s.x,s.y,s.width,s.height,{class:"journey-section section-type-"+t.num},e,t.colour)};let et=-1;const Mt=function(n,t,e){const a=t.x+e.width/2,s=n.append("g");et++,s.append("line").attr("id","task"+et).attr("x1",a).attr("y1",t.y).attr("x2",a).attr("y2",450).attr("class","task-line").attr("stroke-width","1px").attr("stroke-dasharray","4 2").attr("stroke","#666"),Tt(s,{cx:a,cy:300+(5-t.score)*30,score:t.score});const l=X();l.x=t.x,l.y=t.y,l.fill=t.fill,l.width=e.width,l.height=e.height,l.class="task task-type-"+t.num,l.rx=3,l.ry=3,U(s,l),t.x+14,pt(e)(t.task,s,l.x,l.y,l.width,l.height,{class:"task"},e,t.colour)},Lt=function(n,t){U(n,{x:t.startx,y:t.starty,width:t.stopx-t.startx,height:t.stopy-t.starty,fill:t.fill,class:"rect"}).lower()},At=function(){return{x:0,y:0,fill:void 0,"text-anchor":"start",width:100,height:100,textMargin:0,rx:0,ry:0}},X=function(){return{x:0,y:0,width:100,anchor:"start",height:100,rx:0,ry:0}},pt=(function(){function n(s,h,l,p,y,g,_,m){const f=h.append("text").attr("x",l+y/2).attr("y",p+g/2+5).style("font-color",m).style("text-anchor","middle").text(s);a(f,_)}function t(s,h,l,p,y,g,_,m,f){const{taskFontSize:i,taskFontFamily:r}=m,c=s.split(/<br\s*\/?>/gi);for(let d=0;d<c.length;d++){const u=d*i-i*(c.length-1)/2,o=h.append("text").attr("x",l+y/2).attr("y",p).attr("fill",f).style("text-anchor","middle").style("font-size",i).style("font-family",r);o.append("tspan").attr("x",l+y/2).attr("dy",u).text(c[d]),o.attr("y",p+g/2).attr("dominant-baseline","central").attr("alignment-baseline","central"),a(o,_)}}function e(s,h,l,p,y,g,_,m){const f=h.append("switch"),r=f.append("foreignObject").attr("x",l).attr("y",p).attr("width",y).attr("height",g).attr("position","fixed").append("xhtml:div").style("display","table").style("height","100%").style("width","100%");r.append("div").attr("class","label").style("display","table-cell").style("text-align","center").style("vertical-align","middle").text(s),t(s,f,l,p,y,g,_,m),a(r,_)}function a(s,h){for(const l in h)l in h&&s.attr(l,h[l])}return function(s){return s.textPlacement==="fo"?e:s.textPlacement==="old"?n:t}})(),Ht=function(n){n.append("defs").append("marker").attr("id","arrowhead").attr("refX",5).attr("refY",2).attr("markerWidth",6).attr("markerHeight",4).attr("orient","auto").append("path").attr("d","M 0,0 V 4 L6,2 Z")};function yt(n,t){n.each(function(){var e=G(this),a=e.text().split(/(\s+|<br>)/).reverse(),s,h=[],l=1.1,p=e.attr("y"),y=parseFloat(e.attr("dy")),g=e.text(null).append("tspan").attr("x",0).attr("y",p).attr("dy",y+"em");for(let _=0;_<a.length;_++)s=a[a.length-1-_],h.push(s),g.text(h.join(" ").trim()),(g.node().getComputedTextLength()>t||s==="<br>")&&(h.pop(),g.text(h.join(" ").trim()),s==="<br>"?h=[""]:h=[s],g=e.append("tspan").attr("x",0).attr("y",p).attr("dy",l+"em").text(s))})}const Pt=function(n,t,e,a){const s=e%Et-1,h=n.append("g");t.section=s,h.attr("class",(t.class?t.class+" ":"")+"timeline-node "+("section-"+s));const l=h.append("g"),p=h.append("g"),g=p.append("text").text(t.descr).attr("dy","1em").attr("alignment-baseline","middle").attr("dominant-baseline","middle").attr("text-anchor","middle").call(yt,t.width).node().getBBox(),_=a.fontSize&&a.fontSize.replace?a.fontSize.replace("px",""):a.fontSize;return t.height=g.height+_*1.1*.5+t.padding,t.height=Math.max(t.height,t.maxHeight),t.width=t.width+2*t.padding,p.attr("transform","translate("+t.width/2+", "+t.padding/2+")"),zt(l,t,s),t},Ct=function(n,t,e){const a=n.append("g"),h=a.append("text").text(t.descr).attr("dy","1em").attr("alignment-baseline","middle").attr("dominant-baseline","middle").attr("text-anchor","middle").call(yt,t.width).node().getBBox(),l=e.fontSize&&e.fontSize.replace?e.fontSize.replace("px",""):e.fontSize;return a.remove(),h.height+l*1.1*.5+t.padding},zt=function(n,t,e){n.append("path").attr("id","node-"+t.id).attr("class","node-bkg node-"+t.type).attr("d",`M0 ${t.height-5} v${-t.height+10} q0,-5 5,-5 h${t.width-10} q5,0 5,5 v${t.height-5} H0 Z`),n.append("line").attr("class","node-line-"+e).attr("x1",0).attr("y1",t.height).attr("x2",t.width).attr("y2",t.height)},P={drawRect:U,drawCircle:It,drawSection:Nt,drawText:ut,drawLabel:$t,drawTask:Mt,drawBackgroundRect:Lt,getTextObj:At,getNoteRect:X,initGraphics:Ht,drawNode:Pt,getVirtualNodeHeight:Ct},Rt=function(n,t,e,a){var s,h;const l=xt(),p=l.leftMargin??50;E.debug("timeline",a.db);const y=l.securityLevel;let g;y==="sandbox"&&(g=G("#i"+t));const m=(y==="sandbox"?G(g.nodes()[0].contentDocument.body):G("body")).select("#"+t);m.append("g");const f=a.db.getTasks(),i=a.db.getCommonDb().getDiagramTitle();E.debug("task",f),P.initGraphics(m);const r=a.db.getSections();E.debug("sections",r);let c=0,d=0,u=0,o=0,$=50+p,x=50;o=50;let T=0,W=!0;r.forEach(function(w){const v={number:T,descr:w,section:T,width:150,padding:20,maxHeight:c},I=P.getVirtualNodeHeight(m,v,l);E.debug("sectionHeight before draw",I),c=Math.max(c,I+20)});let C=0,A=0;E.debug("tasks.length",f.length);for(const[w,v]of f.entries()){const I={number:w,descr:v,section:v.section,width:150,padding:20,maxHeight:d},H=P.getVirtualNodeHeight(m,I,l);E.debug("taskHeight before draw",H),d=Math.max(d,H+20),C=Math.max(C,v.events.length);let z=0;for(let b=0;b<v.events.length;b++){const S={descr:v.events[b],section:v.section,number:v.section,width:150,padding:20,maxHeight:50};z+=P.getVirtualNodeHeight(m,S,l)}A=Math.max(A,z)}E.debug("maxSectionHeight before draw",c),E.debug("maxTaskHeight before draw",d),r&&r.length>0?r.forEach(w=>{const v=f.filter(b=>b.section===w),I={number:T,descr:w,section:T,width:200*Math.max(v.length,1)-50,padding:20,maxHeight:c};E.debug("sectionNode",I);const H=m.append("g"),z=P.drawNode(H,I,T,l);E.debug("sectionNode output",z),H.attr("transform",`translate(${$}, ${o})`),x+=c+50,v.length>0&&nt(m,v,T,$,x,d,l,C,A,c,!1),$+=200*Math.max(v.length,1),x=o,T++}):(W=!1,nt(m,f,T,$,x,d,l,C,A,c,!0));const B=m.node().getBBox();E.debug("bounds",B),i&&m.append("text").text(i).attr("x",B.width/2-p).attr("font-size","4ex").attr("font-weight","bold").attr("y",20),u=W?c+d+150:d+100,m.append("g").attr("class","lineWrapper").append("line").attr("x1",p).attr("y1",u).attr("x2",B.width+3*p).attr("y2",u).attr("stroke-width",4).attr("stroke","black").attr("marker-end","url(#arrowhead)"),_t(void 0,m,((s=l.timeline)==null?void 0:s.padding)??50,((h=l.timeline)==null?void 0:h.useMaxWidth)??!1)},nt=function(n,t,e,a,s,h,l,p,y,g,_){var m;for(const f of t){const i={descr:f.task,section:e,number:e,width:150,padding:20,maxHeight:h};E.debug("taskNode",i);const r=n.append("g").attr("class","taskWrapper"),d=P.drawNode(r,i,e,l).height;if(E.debug("taskHeight after draw",d),r.attr("transform",`translate(${a}, ${s})`),h=Math.max(h,d),f.events){const u=n.append("g").attr("class","lineWrapper");let o=h;s+=100,o=o+Ft(n,f.events,e,a,s,l),s-=100,u.append("line").attr("x1",a+190/2).attr("y1",s+h).attr("x2",a+190/2).attr("y2",s+h+(_?h:g)+y+120).attr("stroke-width",2).attr("stroke","black").attr("marker-end","url(#arrowhead)").attr("stroke-dasharray","5,5")}a=a+200,_&&!((m=l.timeline)!=null&&m.disableMulticolor)&&e++}s=s-10},Ft=function(n,t,e,a,s,h){let l=0;const p=s;s=s+100;for(const y of t){const g={descr:y,section:e,number:e,width:150,padding:20,maxHeight:50};E.debug("eventNode",g);const _=n.append("g").attr("class","eventWrapper"),f=P.drawNode(_,g,e,h).height;l=l+f,_.attr("transform",`translate(${a}, ${s})`),s=s+10+f}return s=p,l},Vt={setConf:()=>{},draw:Rt},Wt=n=>{let t="";for(let e=0;e<n.THEME_COLOR_LIMIT;e++)n["lineColor"+e]=n["lineColor"+e]||n["cScaleInv"+e],gt(n["lineColor"+e])?n["lineColor"+e]=ft(n["lineColor"+e],20):n["lineColor"+e]=mt(n["lineColor"+e],20);for(let e=0;e<n.THEME_COLOR_LIMIT;e++){const a=""+(17-3*e);t+=`
|
|
7
|
+
.section-${e-1} rect, .section-${e-1} path, .section-${e-1} circle, .section-${e-1} path {
|
|
8
|
+
fill: ${n["cScale"+e]};
|
|
9
|
+
}
|
|
10
|
+
.section-${e-1} text {
|
|
11
|
+
fill: ${n["cScaleLabel"+e]};
|
|
12
|
+
}
|
|
13
|
+
.node-icon-${e-1} {
|
|
14
|
+
font-size: 40px;
|
|
15
|
+
color: ${n["cScaleLabel"+e]};
|
|
16
|
+
}
|
|
17
|
+
.section-edge-${e-1}{
|
|
18
|
+
stroke: ${n["cScale"+e]};
|
|
19
|
+
}
|
|
20
|
+
.edge-depth-${e-1}{
|
|
21
|
+
stroke-width: ${a};
|
|
22
|
+
}
|
|
23
|
+
.section-${e-1} line {
|
|
24
|
+
stroke: ${n["cScaleInv"+e]} ;
|
|
25
|
+
stroke-width: 3;
|
|
26
|
+
}
|
|
27
|
+
|
|
28
|
+
.lineWrapper line{
|
|
29
|
+
stroke: ${n["cScaleLabel"+e]} ;
|
|
30
|
+
}
|
|
31
|
+
|
|
32
|
+
.disabled, .disabled circle, .disabled text {
|
|
33
|
+
fill: lightgray;
|
|
34
|
+
}
|
|
35
|
+
.disabled text {
|
|
36
|
+
fill: #efefef;
|
|
37
|
+
}
|
|
38
|
+
`}return t},Bt=n=>`
|
|
39
|
+
.edge {
|
|
40
|
+
stroke-width: 3;
|
|
41
|
+
}
|
|
42
|
+
${Wt(n)}
|
|
43
|
+
.section-root rect, .section-root path, .section-root circle {
|
|
44
|
+
fill: ${n.git0};
|
|
45
|
+
}
|
|
46
|
+
.section-root text {
|
|
47
|
+
fill: ${n.gitBranchLabel0};
|
|
48
|
+
}
|
|
49
|
+
.icon-container {
|
|
50
|
+
height:100%;
|
|
51
|
+
display: flex;
|
|
52
|
+
justify-content: center;
|
|
53
|
+
align-items: center;
|
|
54
|
+
}
|
|
55
|
+
.edge {
|
|
56
|
+
fill: none;
|
|
57
|
+
}
|
|
58
|
+
.eventWrapper {
|
|
59
|
+
filter: brightness(120%);
|
|
60
|
+
}
|
|
61
|
+
`,Ot=Bt,Zt={db:St,renderer:Vt,parser:vt,styles:Ot};export{Zt as diagram};
|
|
@@ -0,0 +1,61 @@
|
|
|
1
|
+
import{a4 as gt,a5 as ft,a6 as mt,g as xt,l as E,d as G,$ as _t,a7 as bt,r as kt}from"./index-BwSGXyRr.js";import{a as D}from"./arc-ajYHRRnk.js";import"./index-DWUAFoZG.js";import"./isEmpty-Dj2GV0v-.js";import"./path-CbwjOpE9.js";var K=(function(){var n=function(f,i,r,c){for(r=r||{},c=f.length;c--;r[f[c]]=i);return r},t=[6,8,10,11,12,14,16,17,20,21],e=[1,9],a=[1,10],s=[1,11],h=[1,12],l=[1,13],p=[1,16],y=[1,17],g={trace:function(){},yy:{},symbols_:{error:2,start:3,timeline:4,document:5,EOF:6,line:7,SPACE:8,statement:9,NEWLINE:10,title:11,acc_title:12,acc_title_value:13,acc_descr:14,acc_descr_value:15,acc_descr_multiline_value:16,section:17,period_statement:18,event_statement:19,period:20,event:21,$accept:0,$end:1},terminals_:{2:"error",4:"timeline",6:"EOF",8:"SPACE",10:"NEWLINE",11:"title",12:"acc_title",13:"acc_title_value",14:"acc_descr",15:"acc_descr_value",16:"acc_descr_multiline_value",17:"section",20:"period",21:"event"},productions_:[0,[3,3],[5,0],[5,2],[7,2],[7,1],[7,1],[7,1],[9,1],[9,2],[9,2],[9,1],[9,1],[9,1],[9,1],[18,1],[19,1]],performAction:function(i,r,c,d,u,o,$){var x=o.length-1;switch(u){case 1:return o[x-1];case 2:this.$=[];break;case 3:o[x-1].push(o[x]),this.$=o[x-1];break;case 4:case 5:this.$=o[x];break;case 6:case 7:this.$=[];break;case 8:d.getCommonDb().setDiagramTitle(o[x].substr(6)),this.$=o[x].substr(6);break;case 9:this.$=o[x].trim(),d.getCommonDb().setAccTitle(this.$);break;case 10:case 11:this.$=o[x].trim(),d.getCommonDb().setAccDescription(this.$);break;case 12:d.addSection(o[x].substr(8)),this.$=o[x].substr(8);break;case 15:d.addTask(o[x],0,""),this.$=o[x];break;case 16:d.addEvent(o[x].substr(2)),this.$=o[x];break}},table:[{3:1,4:[1,2]},{1:[3]},n(t,[2,2],{5:3}),{6:[1,4],7:5,8:[1,6],9:7,10:[1,8],11:e,12:a,14:s,16:h,17:l,18:14,19:15,20:p,21:y},n(t,[2,7],{1:[2,1]}),n(t,[2,3]),{9:18,11:e,12:a,14:s,16:h,17:l,18:14,19:15,20:p,21:y},n(t,[2,5]),n(t,[2,6]),n(t,[2,8]),{13:[1,19]},{15:[1,20]},n(t,[2,11]),n(t,[2,12]),n(t,[2,13]),n(t,[2,14]),n(t,[2,15]),n(t,[2,16]),n(t,[2,4]),n(t,[2,9]),n(t,[2,10])],defaultActions:{},parseError:function(i,r){if(r.recoverable)this.trace(i);else{var c=new Error(i);throw c.hash=r,c}},parse:function(i){var r=this,c=[0],d=[],u=[null],o=[],$=this.table,x="",T=0,W=0,C=2,A=1,B=o.slice.call(arguments,1),k=Object.create(this.lexer),w={yy:{}};for(var v in this.yy)Object.prototype.hasOwnProperty.call(this.yy,v)&&(w.yy[v]=this.yy[v]);k.setInput(i,w.yy),w.yy.lexer=k,w.yy.parser=this,typeof k.yylloc>"u"&&(k.yylloc={});var I=k.yylloc;o.push(I);var H=k.options&&k.options.ranges;typeof w.yy.parseError=="function"?this.parseError=w.yy.parseError:this.parseError=Object.getPrototypeOf(this).parseError;function z(){var M;return M=d.pop()||k.lex()||A,typeof M!="number"&&(M instanceof Array&&(d=M,M=d.pop()),M=r.symbols_[M]||M),M}for(var b,L,S,Z,R={},O,N,Y,j;;){if(L=c[c.length-1],this.defaultActions[L]?S=this.defaultActions[L]:((b===null||typeof b>"u")&&(b=z()),S=$[L]&&$[L][b]),typeof S>"u"||!S.length||!S[0]){var J="";j=[];for(O in $[L])this.terminals_[O]&&O>C&&j.push("'"+this.terminals_[O]+"'");k.showPosition?J="Parse error on line "+(T+1)+`:
|
|
2
|
+
`+k.showPosition()+`
|
|
3
|
+
Expecting `+j.join(", ")+", got '"+(this.terminals_[b]||b)+"'":J="Parse error on line "+(T+1)+": Unexpected "+(b==A?"end of input":"'"+(this.terminals_[b]||b)+"'"),this.parseError(J,{text:k.match,token:this.terminals_[b]||b,line:k.yylineno,loc:I,expected:j})}if(S[0]instanceof Array&&S.length>1)throw new Error("Parse Error: multiple actions possible at state: "+L+", token: "+b);switch(S[0]){case 1:c.push(b),u.push(k.yytext),o.push(k.yylloc),c.push(S[1]),b=null,W=k.yyleng,x=k.yytext,T=k.yylineno,I=k.yylloc;break;case 2:if(N=this.productions_[S[1]][1],R.$=u[u.length-N],R._$={first_line:o[o.length-(N||1)].first_line,last_line:o[o.length-1].last_line,first_column:o[o.length-(N||1)].first_column,last_column:o[o.length-1].last_column},H&&(R._$.range=[o[o.length-(N||1)].range[0],o[o.length-1].range[1]]),Z=this.performAction.apply(R,[x,W,T,w.yy,S[1],u,o].concat(B)),typeof Z<"u")return Z;N&&(c=c.slice(0,-1*N*2),u=u.slice(0,-1*N),o=o.slice(0,-1*N)),c.push(this.productions_[S[1]][0]),u.push(R.$),o.push(R._$),Y=$[c[c.length-2]][c[c.length-1]],c.push(Y);break;case 3:return!0}}return!0}},_=(function(){var f={EOF:1,parseError:function(r,c){if(this.yy.parser)this.yy.parser.parseError(r,c);else throw new Error(r)},setInput:function(i,r){return this.yy=r||this.yy||{},this._input=i,this._more=this._backtrack=this.done=!1,this.yylineno=this.yyleng=0,this.yytext=this.matched=this.match="",this.conditionStack=["INITIAL"],this.yylloc={first_line:1,first_column:0,last_line:1,last_column:0},this.options.ranges&&(this.yylloc.range=[0,0]),this.offset=0,this},input:function(){var i=this._input[0];this.yytext+=i,this.yyleng++,this.offset++,this.match+=i,this.matched+=i;var r=i.match(/(?:\r\n?|\n).*/g);return r?(this.yylineno++,this.yylloc.last_line++):this.yylloc.last_column++,this.options.ranges&&this.yylloc.range[1]++,this._input=this._input.slice(1),i},unput:function(i){var r=i.length,c=i.split(/(?:\r\n?|\n)/g);this._input=i+this._input,this.yytext=this.yytext.substr(0,this.yytext.length-r),this.offset-=r;var d=this.match.split(/(?:\r\n?|\n)/g);this.match=this.match.substr(0,this.match.length-1),this.matched=this.matched.substr(0,this.matched.length-1),c.length-1&&(this.yylineno-=c.length-1);var u=this.yylloc.range;return this.yylloc={first_line:this.yylloc.first_line,last_line:this.yylineno+1,first_column:this.yylloc.first_column,last_column:c?(c.length===d.length?this.yylloc.first_column:0)+d[d.length-c.length].length-c[0].length:this.yylloc.first_column-r},this.options.ranges&&(this.yylloc.range=[u[0],u[0]+this.yyleng-r]),this.yyleng=this.yytext.length,this},more:function(){return this._more=!0,this},reject:function(){if(this.options.backtrack_lexer)this._backtrack=!0;else return this.parseError("Lexical error on line "+(this.yylineno+1)+`. You can only invoke reject() in the lexer when the lexer is of the backtracking persuasion (options.backtrack_lexer = true).
|
|
4
|
+
`+this.showPosition(),{text:"",token:null,line:this.yylineno});return this},less:function(i){this.unput(this.match.slice(i))},pastInput:function(){var i=this.matched.substr(0,this.matched.length-this.match.length);return(i.length>20?"...":"")+i.substr(-20).replace(/\n/g,"")},upcomingInput:function(){var i=this.match;return i.length<20&&(i+=this._input.substr(0,20-i.length)),(i.substr(0,20)+(i.length>20?"...":"")).replace(/\n/g,"")},showPosition:function(){var i=this.pastInput(),r=new Array(i.length+1).join("-");return i+this.upcomingInput()+`
|
|
5
|
+
`+r+"^"},test_match:function(i,r){var c,d,u;if(this.options.backtrack_lexer&&(u={yylineno:this.yylineno,yylloc:{first_line:this.yylloc.first_line,last_line:this.last_line,first_column:this.yylloc.first_column,last_column:this.yylloc.last_column},yytext:this.yytext,match:this.match,matches:this.matches,matched:this.matched,yyleng:this.yyleng,offset:this.offset,_more:this._more,_input:this._input,yy:this.yy,conditionStack:this.conditionStack.slice(0),done:this.done},this.options.ranges&&(u.yylloc.range=this.yylloc.range.slice(0))),d=i[0].match(/(?:\r\n?|\n).*/g),d&&(this.yylineno+=d.length),this.yylloc={first_line:this.yylloc.last_line,last_line:this.yylineno+1,first_column:this.yylloc.last_column,last_column:d?d[d.length-1].length-d[d.length-1].match(/\r?\n?/)[0].length:this.yylloc.last_column+i[0].length},this.yytext+=i[0],this.match+=i[0],this.matches=i,this.yyleng=this.yytext.length,this.options.ranges&&(this.yylloc.range=[this.offset,this.offset+=this.yyleng]),this._more=!1,this._backtrack=!1,this._input=this._input.slice(i[0].length),this.matched+=i[0],c=this.performAction.call(this,this.yy,this,r,this.conditionStack[this.conditionStack.length-1]),this.done&&this._input&&(this.done=!1),c)return c;if(this._backtrack){for(var o in u)this[o]=u[o];return!1}return!1},next:function(){if(this.done)return this.EOF;this._input||(this.done=!0);var i,r,c,d;this._more||(this.yytext="",this.match="");for(var u=this._currentRules(),o=0;o<u.length;o++)if(c=this._input.match(this.rules[u[o]]),c&&(!r||c[0].length>r[0].length)){if(r=c,d=o,this.options.backtrack_lexer){if(i=this.test_match(c,u[o]),i!==!1)return i;if(this._backtrack){r=!1;continue}else return!1}else if(!this.options.flex)break}return r?(i=this.test_match(r,u[d]),i!==!1?i:!1):this._input===""?this.EOF:this.parseError("Lexical error on line "+(this.yylineno+1)+`. Unrecognized text.
|
|
6
|
+
`+this.showPosition(),{text:"",token:null,line:this.yylineno})},lex:function(){var r=this.next();return r||this.lex()},begin:function(r){this.conditionStack.push(r)},popState:function(){var r=this.conditionStack.length-1;return r>0?this.conditionStack.pop():this.conditionStack[0]},_currentRules:function(){return this.conditionStack.length&&this.conditionStack[this.conditionStack.length-1]?this.conditions[this.conditionStack[this.conditionStack.length-1]].rules:this.conditions.INITIAL.rules},topState:function(r){return r=this.conditionStack.length-1-Math.abs(r||0),r>=0?this.conditionStack[r]:"INITIAL"},pushState:function(r){this.begin(r)},stateStackSize:function(){return this.conditionStack.length},options:{"case-insensitive":!0},performAction:function(r,c,d,u){switch(d){case 0:break;case 1:break;case 2:return 10;case 3:break;case 4:break;case 5:return 4;case 6:return 11;case 7:return this.begin("acc_title"),12;case 8:return this.popState(),"acc_title_value";case 9:return this.begin("acc_descr"),14;case 10:return this.popState(),"acc_descr_value";case 11:this.begin("acc_descr_multiline");break;case 12:this.popState();break;case 13:return"acc_descr_multiline_value";case 14:return 17;case 15:return 21;case 16:return 20;case 17:return 6;case 18:return"INVALID"}},rules:[/^(?:%(?!\{)[^\n]*)/i,/^(?:[^\}]%%[^\n]*)/i,/^(?:[\n]+)/i,/^(?:\s+)/i,/^(?:#[^\n]*)/i,/^(?:timeline\b)/i,/^(?:title\s[^#\n;]+)/i,/^(?:accTitle\s*:\s*)/i,/^(?:(?!\n||)*[^\n]*)/i,/^(?:accDescr\s*:\s*)/i,/^(?:(?!\n||)*[^\n]*)/i,/^(?:accDescr\s*\{\s*)/i,/^(?:[\}])/i,/^(?:[^\}]*)/i,/^(?:section\s[^#:\n;]+)/i,/^(?::\s[^#:\n;]+)/i,/^(?:[^#:\n;]+)/i,/^(?:$)/i,/^(?:.)/i],conditions:{acc_descr_multiline:{rules:[12,13],inclusive:!1},acc_descr:{rules:[10],inclusive:!1},acc_title:{rules:[8],inclusive:!1},INITIAL:{rules:[0,1,2,3,4,5,6,7,9,11,14,15,16,17,18],inclusive:!0}}};return f})();g.lexer=_;function m(){this.yy={}}return m.prototype=g,g.Parser=m,new m})();K.parser=K;const vt=K;let F="",st=0;const Q=[],q=[],V=[],it=()=>bt,rt=function(){Q.length=0,q.length=0,F="",V.length=0,kt()},at=function(n){F=n,Q.push(n)},lt=function(){return Q},ot=function(){let n=tt();const t=100;let e=0;for(;!n&&e<t;)n=tt(),e++;return q.push(...V),q},ct=function(n,t,e){const a={id:st++,section:F,type:F,task:n,score:t||0,events:e?[e]:[]};V.push(a)},ht=function(n){V.find(e=>e.id===st-1).events.push(n)},dt=function(n){const t={section:F,type:F,description:n,task:n,classes:[]};q.push(t)},tt=function(){const n=function(e){return V[e].processed};let t=!0;for(const[e,a]of V.entries())n(e),t=t&&a.processed;return t},wt={clear:rt,getCommonDb:it,addSection:at,getSections:lt,getTasks:ot,addTask:ct,addTaskOrg:dt,addEvent:ht},St=Object.freeze(Object.defineProperty({__proto__:null,addEvent:ht,addSection:at,addTask:ct,addTaskOrg:dt,clear:rt,default:wt,getCommonDb:it,getSections:lt,getTasks:ot},Symbol.toStringTag,{value:"Module"})),Et=12,U=function(n,t){const e=n.append("rect");return e.attr("x",t.x),e.attr("y",t.y),e.attr("fill",t.fill),e.attr("stroke",t.stroke),e.attr("width",t.width),e.attr("height",t.height),e.attr("rx",t.rx),e.attr("ry",t.ry),t.class!==void 0&&e.attr("class",t.class),e},Tt=function(n,t){const a=n.append("circle").attr("cx",t.cx).attr("cy",t.cy).attr("class","face").attr("r",15).attr("stroke-width",2).attr("overflow","visible"),s=n.append("g");s.append("circle").attr("cx",t.cx-15/3).attr("cy",t.cy-15/3).attr("r",1.5).attr("stroke-width",2).attr("fill","#666").attr("stroke","#666"),s.append("circle").attr("cx",t.cx+15/3).attr("cy",t.cy-15/3).attr("r",1.5).attr("stroke-width",2).attr("fill","#666").attr("stroke","#666");function h(y){const g=D().startAngle(Math.PI/2).endAngle(3*(Math.PI/2)).innerRadius(7.5).outerRadius(6.8181818181818175);y.append("path").attr("class","mouth").attr("d",g).attr("transform","translate("+t.cx+","+(t.cy+2)+")")}function l(y){const g=D().startAngle(3*Math.PI/2).endAngle(5*(Math.PI/2)).innerRadius(7.5).outerRadius(6.8181818181818175);y.append("path").attr("class","mouth").attr("d",g).attr("transform","translate("+t.cx+","+(t.cy+7)+")")}function p(y){y.append("line").attr("class","mouth").attr("stroke",2).attr("x1",t.cx-5).attr("y1",t.cy+7).attr("x2",t.cx+5).attr("y2",t.cy+7).attr("class","mouth").attr("stroke-width","1px").attr("stroke","#666")}return t.score>3?h(s):t.score<3?l(s):p(s),a},It=function(n,t){const e=n.append("circle");return e.attr("cx",t.cx),e.attr("cy",t.cy),e.attr("class","actor-"+t.pos),e.attr("fill",t.fill),e.attr("stroke",t.stroke),e.attr("r",t.r),e.class!==void 0&&e.attr("class",e.class),t.title!==void 0&&e.append("title").text(t.title),e},ut=function(n,t){const e=t.text.replace(/<br\s*\/?>/gi," "),a=n.append("text");a.attr("x",t.x),a.attr("y",t.y),a.attr("class","legend"),a.style("text-anchor",t.anchor),t.class!==void 0&&a.attr("class",t.class);const s=a.append("tspan");return s.attr("x",t.x+t.textMargin*2),s.text(e),a},$t=function(n,t){function e(s,h,l,p,y){return s+","+h+" "+(s+l)+","+h+" "+(s+l)+","+(h+p-y)+" "+(s+l-y*1.2)+","+(h+p)+" "+s+","+(h+p)}const a=n.append("polygon");a.attr("points",e(t.x,t.y,50,20,7)),a.attr("class","labelBox"),t.y=t.y+t.labelMargin,t.x=t.x+.5*t.labelMargin,ut(n,t)},Nt=function(n,t,e){const a=n.append("g"),s=X();s.x=t.x,s.y=t.y,s.fill=t.fill,s.width=e.width,s.height=e.height,s.class="journey-section section-type-"+t.num,s.rx=3,s.ry=3,U(a,s),pt(e)(t.text,a,s.x,s.y,s.width,s.height,{class:"journey-section section-type-"+t.num},e,t.colour)};let et=-1;const Mt=function(n,t,e){const a=t.x+e.width/2,s=n.append("g");et++,s.append("line").attr("id","task"+et).attr("x1",a).attr("y1",t.y).attr("x2",a).attr("y2",450).attr("class","task-line").attr("stroke-width","1px").attr("stroke-dasharray","4 2").attr("stroke","#666"),Tt(s,{cx:a,cy:300+(5-t.score)*30,score:t.score});const l=X();l.x=t.x,l.y=t.y,l.fill=t.fill,l.width=e.width,l.height=e.height,l.class="task task-type-"+t.num,l.rx=3,l.ry=3,U(s,l),t.x+14,pt(e)(t.task,s,l.x,l.y,l.width,l.height,{class:"task"},e,t.colour)},Lt=function(n,t){U(n,{x:t.startx,y:t.starty,width:t.stopx-t.startx,height:t.stopy-t.starty,fill:t.fill,class:"rect"}).lower()},At=function(){return{x:0,y:0,fill:void 0,"text-anchor":"start",width:100,height:100,textMargin:0,rx:0,ry:0}},X=function(){return{x:0,y:0,width:100,anchor:"start",height:100,rx:0,ry:0}},pt=(function(){function n(s,h,l,p,y,g,_,m){const f=h.append("text").attr("x",l+y/2).attr("y",p+g/2+5).style("font-color",m).style("text-anchor","middle").text(s);a(f,_)}function t(s,h,l,p,y,g,_,m,f){const{taskFontSize:i,taskFontFamily:r}=m,c=s.split(/<br\s*\/?>/gi);for(let d=0;d<c.length;d++){const u=d*i-i*(c.length-1)/2,o=h.append("text").attr("x",l+y/2).attr("y",p).attr("fill",f).style("text-anchor","middle").style("font-size",i).style("font-family",r);o.append("tspan").attr("x",l+y/2).attr("dy",u).text(c[d]),o.attr("y",p+g/2).attr("dominant-baseline","central").attr("alignment-baseline","central"),a(o,_)}}function e(s,h,l,p,y,g,_,m){const f=h.append("switch"),r=f.append("foreignObject").attr("x",l).attr("y",p).attr("width",y).attr("height",g).attr("position","fixed").append("xhtml:div").style("display","table").style("height","100%").style("width","100%");r.append("div").attr("class","label").style("display","table-cell").style("text-align","center").style("vertical-align","middle").text(s),t(s,f,l,p,y,g,_,m),a(r,_)}function a(s,h){for(const l in h)l in h&&s.attr(l,h[l])}return function(s){return s.textPlacement==="fo"?e:s.textPlacement==="old"?n:t}})(),Ht=function(n){n.append("defs").append("marker").attr("id","arrowhead").attr("refX",5).attr("refY",2).attr("markerWidth",6).attr("markerHeight",4).attr("orient","auto").append("path").attr("d","M 0,0 V 4 L6,2 Z")};function yt(n,t){n.each(function(){var e=G(this),a=e.text().split(/(\s+|<br>)/).reverse(),s,h=[],l=1.1,p=e.attr("y"),y=parseFloat(e.attr("dy")),g=e.text(null).append("tspan").attr("x",0).attr("y",p).attr("dy",y+"em");for(let _=0;_<a.length;_++)s=a[a.length-1-_],h.push(s),g.text(h.join(" ").trim()),(g.node().getComputedTextLength()>t||s==="<br>")&&(h.pop(),g.text(h.join(" ").trim()),s==="<br>"?h=[""]:h=[s],g=e.append("tspan").attr("x",0).attr("y",p).attr("dy",l+"em").text(s))})}const Pt=function(n,t,e,a){const s=e%Et-1,h=n.append("g");t.section=s,h.attr("class",(t.class?t.class+" ":"")+"timeline-node "+("section-"+s));const l=h.append("g"),p=h.append("g"),g=p.append("text").text(t.descr).attr("dy","1em").attr("alignment-baseline","middle").attr("dominant-baseline","middle").attr("text-anchor","middle").call(yt,t.width).node().getBBox(),_=a.fontSize&&a.fontSize.replace?a.fontSize.replace("px",""):a.fontSize;return t.height=g.height+_*1.1*.5+t.padding,t.height=Math.max(t.height,t.maxHeight),t.width=t.width+2*t.padding,p.attr("transform","translate("+t.width/2+", "+t.padding/2+")"),zt(l,t,s),t},Ct=function(n,t,e){const a=n.append("g"),h=a.append("text").text(t.descr).attr("dy","1em").attr("alignment-baseline","middle").attr("dominant-baseline","middle").attr("text-anchor","middle").call(yt,t.width).node().getBBox(),l=e.fontSize&&e.fontSize.replace?e.fontSize.replace("px",""):e.fontSize;return a.remove(),h.height+l*1.1*.5+t.padding},zt=function(n,t,e){n.append("path").attr("id","node-"+t.id).attr("class","node-bkg node-"+t.type).attr("d",`M0 ${t.height-5} v${-t.height+10} q0,-5 5,-5 h${t.width-10} q5,0 5,5 v${t.height-5} H0 Z`),n.append("line").attr("class","node-line-"+e).attr("x1",0).attr("y1",t.height).attr("x2",t.width).attr("y2",t.height)},P={drawRect:U,drawCircle:It,drawSection:Nt,drawText:ut,drawLabel:$t,drawTask:Mt,drawBackgroundRect:Lt,getTextObj:At,getNoteRect:X,initGraphics:Ht,drawNode:Pt,getVirtualNodeHeight:Ct},Rt=function(n,t,e,a){var s,h;const l=xt(),p=l.leftMargin??50;E.debug("timeline",a.db);const y=l.securityLevel;let g;y==="sandbox"&&(g=G("#i"+t));const m=(y==="sandbox"?G(g.nodes()[0].contentDocument.body):G("body")).select("#"+t);m.append("g");const f=a.db.getTasks(),i=a.db.getCommonDb().getDiagramTitle();E.debug("task",f),P.initGraphics(m);const r=a.db.getSections();E.debug("sections",r);let c=0,d=0,u=0,o=0,$=50+p,x=50;o=50;let T=0,W=!0;r.forEach(function(w){const v={number:T,descr:w,section:T,width:150,padding:20,maxHeight:c},I=P.getVirtualNodeHeight(m,v,l);E.debug("sectionHeight before draw",I),c=Math.max(c,I+20)});let C=0,A=0;E.debug("tasks.length",f.length);for(const[w,v]of f.entries()){const I={number:w,descr:v,section:v.section,width:150,padding:20,maxHeight:d},H=P.getVirtualNodeHeight(m,I,l);E.debug("taskHeight before draw",H),d=Math.max(d,H+20),C=Math.max(C,v.events.length);let z=0;for(let b=0;b<v.events.length;b++){const S={descr:v.events[b],section:v.section,number:v.section,width:150,padding:20,maxHeight:50};z+=P.getVirtualNodeHeight(m,S,l)}A=Math.max(A,z)}E.debug("maxSectionHeight before draw",c),E.debug("maxTaskHeight before draw",d),r&&r.length>0?r.forEach(w=>{const v=f.filter(b=>b.section===w),I={number:T,descr:w,section:T,width:200*Math.max(v.length,1)-50,padding:20,maxHeight:c};E.debug("sectionNode",I);const H=m.append("g"),z=P.drawNode(H,I,T,l);E.debug("sectionNode output",z),H.attr("transform",`translate(${$}, ${o})`),x+=c+50,v.length>0&&nt(m,v,T,$,x,d,l,C,A,c,!1),$+=200*Math.max(v.length,1),x=o,T++}):(W=!1,nt(m,f,T,$,x,d,l,C,A,c,!0));const B=m.node().getBBox();E.debug("bounds",B),i&&m.append("text").text(i).attr("x",B.width/2-p).attr("font-size","4ex").attr("font-weight","bold").attr("y",20),u=W?c+d+150:d+100,m.append("g").attr("class","lineWrapper").append("line").attr("x1",p).attr("y1",u).attr("x2",B.width+3*p).attr("y2",u).attr("stroke-width",4).attr("stroke","black").attr("marker-end","url(#arrowhead)"),_t(void 0,m,((s=l.timeline)==null?void 0:s.padding)??50,((h=l.timeline)==null?void 0:h.useMaxWidth)??!1)},nt=function(n,t,e,a,s,h,l,p,y,g,_){var m;for(const f of t){const i={descr:f.task,section:e,number:e,width:150,padding:20,maxHeight:h};E.debug("taskNode",i);const r=n.append("g").attr("class","taskWrapper"),d=P.drawNode(r,i,e,l).height;if(E.debug("taskHeight after draw",d),r.attr("transform",`translate(${a}, ${s})`),h=Math.max(h,d),f.events){const u=n.append("g").attr("class","lineWrapper");let o=h;s+=100,o=o+Ft(n,f.events,e,a,s,l),s-=100,u.append("line").attr("x1",a+190/2).attr("y1",s+h).attr("x2",a+190/2).attr("y2",s+h+(_?h:g)+y+120).attr("stroke-width",2).attr("stroke","black").attr("marker-end","url(#arrowhead)").attr("stroke-dasharray","5,5")}a=a+200,_&&!((m=l.timeline)!=null&&m.disableMulticolor)&&e++}s=s-10},Ft=function(n,t,e,a,s,h){let l=0;const p=s;s=s+100;for(const y of t){const g={descr:y,section:e,number:e,width:150,padding:20,maxHeight:50};E.debug("eventNode",g);const _=n.append("g").attr("class","eventWrapper"),f=P.drawNode(_,g,e,h).height;l=l+f,_.attr("transform",`translate(${a}, ${s})`),s=s+10+f}return s=p,l},Vt={setConf:()=>{},draw:Rt},Wt=n=>{let t="";for(let e=0;e<n.THEME_COLOR_LIMIT;e++)n["lineColor"+e]=n["lineColor"+e]||n["cScaleInv"+e],gt(n["lineColor"+e])?n["lineColor"+e]=ft(n["lineColor"+e],20):n["lineColor"+e]=mt(n["lineColor"+e],20);for(let e=0;e<n.THEME_COLOR_LIMIT;e++){const a=""+(17-3*e);t+=`
|
|
7
|
+
.section-${e-1} rect, .section-${e-1} path, .section-${e-1} circle, .section-${e-1} path {
|
|
8
|
+
fill: ${n["cScale"+e]};
|
|
9
|
+
}
|
|
10
|
+
.section-${e-1} text {
|
|
11
|
+
fill: ${n["cScaleLabel"+e]};
|
|
12
|
+
}
|
|
13
|
+
.node-icon-${e-1} {
|
|
14
|
+
font-size: 40px;
|
|
15
|
+
color: ${n["cScaleLabel"+e]};
|
|
16
|
+
}
|
|
17
|
+
.section-edge-${e-1}{
|
|
18
|
+
stroke: ${n["cScale"+e]};
|
|
19
|
+
}
|
|
20
|
+
.edge-depth-${e-1}{
|
|
21
|
+
stroke-width: ${a};
|
|
22
|
+
}
|
|
23
|
+
.section-${e-1} line {
|
|
24
|
+
stroke: ${n["cScaleInv"+e]} ;
|
|
25
|
+
stroke-width: 3;
|
|
26
|
+
}
|
|
27
|
+
|
|
28
|
+
.lineWrapper line{
|
|
29
|
+
stroke: ${n["cScaleLabel"+e]} ;
|
|
30
|
+
}
|
|
31
|
+
|
|
32
|
+
.disabled, .disabled circle, .disabled text {
|
|
33
|
+
fill: lightgray;
|
|
34
|
+
}
|
|
35
|
+
.disabled text {
|
|
36
|
+
fill: #efefef;
|
|
37
|
+
}
|
|
38
|
+
`}return t},Bt=n=>`
|
|
39
|
+
.edge {
|
|
40
|
+
stroke-width: 3;
|
|
41
|
+
}
|
|
42
|
+
${Wt(n)}
|
|
43
|
+
.section-root rect, .section-root path, .section-root circle {
|
|
44
|
+
fill: ${n.git0};
|
|
45
|
+
}
|
|
46
|
+
.section-root text {
|
|
47
|
+
fill: ${n.gitBranchLabel0};
|
|
48
|
+
}
|
|
49
|
+
.icon-container {
|
|
50
|
+
height:100%;
|
|
51
|
+
display: flex;
|
|
52
|
+
justify-content: center;
|
|
53
|
+
align-items: center;
|
|
54
|
+
}
|
|
55
|
+
.edge {
|
|
56
|
+
fill: none;
|
|
57
|
+
}
|
|
58
|
+
.eventWrapper {
|
|
59
|
+
filter: brightness(120%);
|
|
60
|
+
}
|
|
61
|
+
`,Ot=Bt,Jt={db:St,renderer:Vt,parser:vt,styles:Ot};export{Jt as diagram};
|
|
@@ -0,0 +1,47 @@
|
|
|
1
|
+
const __vite__mapDeps=(i,m=__vite__mapDeps,d=(m.f||(m.f=["./index-BwSGXyRr.js","./index-DWUAFoZG.js","./index-B2dvADz8.css","./isEmpty-Dj2GV0v-.js","./index-Dn0YtZ2R.js","./index-BicRPzXC.js","./index.dom-C3-224fz.js","./batch-image-generation-Baqb01Lm.js","./index-DBWqXBIQ.js","./pick-Cvlwra4g.js","./hasIn-4iY02rGN.js","./index-C1XdOOAn.css","./batch-image-generation-CbLMWmjk.css","./settings-dialog-QUxXj54T.css"])))=>i.map(i=>d[i]);
|
|
2
|
+
import{r as s,I as Nt,_ as Et,C as e,aA as Pe,bU as Tt,bV as Pt,bW as Me,bX as Mt,bY as kt,bZ as Rt,b_ as Ot,b$ as At,c0 as zt,c1 as Lt,c2 as ke,y as we,z as he,c3 as Te,U as be,c4 as at,by as st,bz as rt,c5 as Re,c6 as Ft,c7 as nt,c8 as ot,L as ye,m as X,c9 as it,ca as $t,cb as ge,cc as Ut,cd as Vt,ce as lt,cf as Bt,cg as Gt,ch as Wt,ci as Ht,cj as qt,ck as Kt,cl as Yt,cm as Jt,cn as Se,co as De,cp as Oe,H as Ae,cq as Qt,aW as ct,aQ as de,aY as Xt,aV as Zt,M as ea,Q,N as ze,R as ta,a0 as aa,a1 as sa,cr as Le,cs as Fe,ct as ra,W as pe,aT as na,aU as oa,cu as ia,$ as $e,cv as la,cw as ca,cx as ee,cy as da,cz as ua,cA as ma,u as pa,cB as ha,cC as fa,cD as ga,aD as ne,J as va,n as J,Y as xa,cE as wa,cF as Ue,V as ba,cG as ya,cH as Ie,cI as Ve,cJ as Be,E as Ge,F as We,cK as He,cL as qe}from"./index-DWUAFoZG.js";/* empty css */import{S as _e}from"./index-DBWqXBIQ.js";import"./pick-Cvlwra4g.js";import"./hasIn-4iY02rGN.js";function Ke(a,t){var n=Object.keys(a);if(Object.getOwnPropertySymbols){var o=Object.getOwnPropertySymbols(a);t&&(o=o.filter(function(r){return Object.getOwnPropertyDescriptor(a,r).enumerable})),n.push.apply(n,o)}return n}function Ye(a){for(var t=1;t<arguments.length;t++){var n=arguments[t]!=null?arguments[t]:{};t%2?Ke(Object(n),!0).forEach(function(o){Et(a,o,n[o])}):Object.getOwnPropertyDescriptors?Object.defineProperties(a,Object.getOwnPropertyDescriptors(n)):Ke(Object(n)).forEach(function(o){Object.defineProperty(a,o,Object.getOwnPropertyDescriptor(n,o))})}return a}var _a={tag:"svg",attrs:{fill:"none",viewBox:"0 0 24 24",width:"1em",height:"1em"},children:[{tag:"path",attrs:{fill:"currentColor",d:"M12 21C16.9706 21 21 16.9706 21 12C21 7.02944 16.9706 3 12 3C7.02944 3 3 7.02944 3 12C3 16.9706 7.02944 21 12 21ZM23 12C23 18.0751 18.0751 23 12 23C5.92487 23 0.999999 18.0751 1 12C1 5.92487 5.92487 0.999999 12 1C18.0751 1 23 5.92487 23 12ZM15 16.4142L11 12.4142L11 5.5H13L13 11.5858L16.4142 15L15 16.4142Z"}}]},Ne=s.forwardRef(function(a,t){return s.createElement(Nt,Ye(Ye({},a),{},{id:"time",ref:t,icon:_a}))});Ne.displayName="TimeIcon";const dt=({children:a})=>e.jsx("div",{className:"ttd-dialog-panels",children:a}),xe=({label:a,children:t,panelAction:n,panelActionDisabled:o=!1,onTextSubmitInProgress:r,renderTopRight:c,renderSubmitShortcut:m,renderBottomRight:v})=>e.jsxs("div",{className:"ttd-dialog-panel",children:[e.jsxs("div",{className:"ttd-dialog-panel__header",children:[e.jsx("label",{children:a}),c==null?void 0:c()]}),t,e.jsxs("div",{className:Pe("ttd-dialog-panel-button-container",{invisible:!n}),style:{display:"flex",alignItems:"center"},children:[e.jsx("button",{className:"ttd-dialog-panel-button drawnix-button ","data-track":"ttd_click_panel_action",onClick:n&&n.action,disabled:o||r,children:e.jsxs("div",{className:Pe({invisible:r}),children:[n==null?void 0:n.label,(n==null?void 0:n.icon)&&e.jsx("span",{children:n.icon})]})}),!o&&!r&&(m==null?void 0:m()),v==null?void 0:v()]})]}),Je={CTRL_OR_CMD:Tt||Pt?"metaKey":"ctrlKey",ENTER:"Enter"},ut=({input:a,placeholder:t,onChange:n,onKeyboardSubmit:o})=>{const r=s.useRef(null),c=s.useRef(o);return c.current=o,s.useEffect(()=>{if(!c.current)return;const m=r.current;if(m){const v=x=>{var u;x[Je.CTRL_OR_CMD]&&x.key===Je.ENTER&&(x.preventDefault(),(u=c.current)==null||u.call(c))};return m.addEventListener(Me.KEYDOWN,v),()=>{m.removeEventListener(Me.KEYDOWN,v)}}},[]),e.jsx("textarea",{className:"ttd-dialog-input",onChange:n,value:a,placeholder:t,autoFocus:!0,ref:r})},ja=({error:a})=>e.jsxs("div",{"data-testid":"ttd-dialog-output-error",className:"ttd-dialog-output-error",children:["Error! ",e.jsx("p",{children:a})]}),mt=({error:a,value:t,loaded:n})=>{const o=[kt,Rt,Ot,At],r={readonly:!0,hideScrollbar:!1,disabledScrollOnNonFocus:!0,themeColors:zt};return e.jsxs("div",{className:"ttd-dialog-output-wrapper",children:[a&&e.jsx(ja,{error:a.message}),e.jsx("div",{style:{opacity:a?"0.15":1},className:"ttd-dialog-output-canvas-container",children:e.jsx(Mt,{value:t,options:r,plugins:o,children:e.jsx(Lt,{})})})]})},pt=()=>e.jsxs("div",{className:"ttd-dialog-submit-shortcut",children:[e.jsx("div",{className:"ttd-dialog-submit-shortcut__key",children:ke("CtrlOrCmd")}),e.jsx("div",{className:"ttd-dialog-submit-shortcut__key",children:ke("Enter")})]}),Ia=`flowchart TD
|
|
3
|
+
A[Christmas] -->|Get money| B(Go shopping)
|
|
4
|
+
B --> C{Let me think}
|
|
5
|
+
C -->|One| D[Laptop]
|
|
6
|
+
C -->|Two| E[iPhone]
|
|
7
|
+
C -->|Three| F[Car]`,Ca=()=>{const{appState:a,setAppState:t}=we(),{t:n,language:o}=he(),[r,c]=s.useState({loaded:!1,api:Promise.resolve({parseMermaidToDrawnix:async()=>({elements:[]})})});s.useEffect(()=>{(async()=>{try{const w=await be(()=>import("./index-BwSGXyRr.js").then(I=>I.aq),__vite__mapDeps([0,1,2,3]),import.meta.url);c({loaded:!0,api:Promise.resolve(w)})}catch(w){console.error("Failed to load mermaid library:",w),_(new Error(n("dialog.error.loadMermaid")))}})()},[]);const[m,v]=s.useState(()=>Ia),[x,u]=s.useState(()=>[]),C=s.useDeferredValue(m.trim()),[U,_]=s.useState(null),d=Te();s.useEffect(()=>{(async()=>{try{const w=await r.api;let I;try{I=await w.parseMermaidToDrawnix(C)}catch{I=await w.parseMermaidToDrawnix(C.replace(/"/g,"'"))}const{elements:z}=I;u(z),_(null)}catch(w){_(w)}})()},[C,r]);const j=()=>{if(!x.length)return;let f;const w=at(d);if(w)f=w;else{const I=st.getBoardContainer(d).getBoundingClientRect(),z=[I.width/2,I.height/2],y=d.viewport.zoom,b=rt(d),p=b[0]+z[0]/y,h=b[1]+z[1]/y,L=x,N=Re.getBoundingRectangle(L.filter(A=>!Ft.isGroup(A)).map(A=>Re.getRectangleByPoints(A.points)));f=[p-N.width/2,h-N.height/2]}d.insertFragment({elements:JSON.parse(JSON.stringify(x))},f,nt.paste),f&&requestAnimationFrame(()=>{ot(d,f)}),t({...a,openDialogType:null})};return e.jsxs(e.Fragment,{children:[e.jsx("div",{className:"ttd-dialog-desc",children:o==="zh"?e.jsxs(e.Fragment,{children:[n("dialog.mermaid.description")," ",e.jsx("a",{href:"https://mermaid.js.org/syntax/flowchart.html",target:"_blank",rel:"noreferrer",children:n("dialog.mermaid.flowchart")}),"、",e.jsx("a",{href:"https://mermaid.js.org/syntax/sequenceDiagram.html",target:"_blank",rel:"noreferrer",children:n("dialog.mermaid.sequence")})," ","和"," ",e.jsx("a",{href:"https://mermaid.js.org/syntax/classDiagram.html",target:"_blank",rel:"noreferrer",children:n("dialog.mermaid.class")}),n("dialog.mermaid.otherTypes")]}):e.jsxs(e.Fragment,{children:[n("dialog.mermaid.description")," ",e.jsx("a",{href:"https://mermaid.js.org/syntax/flowchart.html",target:"_blank",rel:"noreferrer",children:n("dialog.mermaid.flowchart")}),","," ",e.jsx("a",{href:"https://mermaid.js.org/syntax/sequenceDiagram.html",target:"_blank",rel:"noreferrer",children:n("dialog.mermaid.sequence")}),","," ",e.jsx("a",{href:"https://mermaid.js.org/syntax/classDiagram.html",target:"_blank",rel:"noreferrer",children:n("dialog.mermaid.class")}),n("dialog.mermaid.otherTypes")]})}),e.jsxs(dt,{children:[e.jsx(xe,{label:n("dialog.mermaid.syntax"),children:e.jsx(ut,{input:m,placeholder:n("dialog.mermaid.placeholder"),onChange:f=>v(f.target.value),onKeyboardSubmit:()=>{j()}})}),e.jsx(xe,{label:n("dialog.mermaid.preview"),panelAction:{action:()=>{j()},label:n("dialog.mermaid.insert")},renderSubmitShortcut:()=>e.jsx(pt,{}),children:e.jsx(mt,{value:x,loaded:r.loaded,error:U})})]})]})},Qe=a=>a==="zh"?`# 我开始了
|
|
8
|
+
|
|
9
|
+
- 让我看看是谁搞出了这个 bug 🕵️ ♂️ 🔍
|
|
10
|
+
- 😯 💣
|
|
11
|
+
- 原来是我 👈 🎯 💘
|
|
12
|
+
|
|
13
|
+
- 竟然不可以运行,为什么呢 🚫 ⚙️ ❓
|
|
14
|
+
- 竟然可以运行了,为什么呢?🎢 ✨
|
|
15
|
+
- 🤯 ⚡ ➡️ 🎉
|
|
16
|
+
|
|
17
|
+
- 能运行起来的 🐞 🚀
|
|
18
|
+
- 就不要去动它 🛑 ✋
|
|
19
|
+
- 👾 💥 🏹 🎯
|
|
20
|
+
|
|
21
|
+
## 男孩还是女孩 👶 ❓ 🤷 ♂️ ♀️
|
|
22
|
+
|
|
23
|
+
### Hello world 👋 🌍 ✨ 💻
|
|
24
|
+
|
|
25
|
+
#### 哇 是个程序员 🤯 ⌨️ 💡 👩 💻`:`# I have started
|
|
26
|
+
|
|
27
|
+
- Let me see who made this bug 🕵️ ♂️ 🔍
|
|
28
|
+
- 😯 💣
|
|
29
|
+
- Turns out it was me 👈 🎯 💘
|
|
30
|
+
|
|
31
|
+
- Unexpectedly, it cannot run; why is that 🚫 ⚙️ ❓
|
|
32
|
+
- Unexpectedly, it can run now; why is that? 🎢 ✨
|
|
33
|
+
- 🤯 ⚡ ➡️ 🎉
|
|
34
|
+
|
|
35
|
+
- What can run 🐞 🚀
|
|
36
|
+
- then do not touch it 🛑 ✋
|
|
37
|
+
- 👾 💥 🏹 🎯
|
|
38
|
+
|
|
39
|
+
## Boy or girl 👶 ❓ 🤷 ♂️ ♀️
|
|
40
|
+
|
|
41
|
+
### Hello world 👋 🌍 ✨ 💻
|
|
42
|
+
|
|
43
|
+
#### Wow, a programmer 🤯 ⌨️ 💡 👩 💻`,Sa=()=>{const{appState:a,setAppState:t}=we(),{t:n,language:o}=he(),[r,c]=s.useState({loaded:!1,api:Promise.resolve({parseMarkdownToDrawnix:(f,w)=>null})});s.useEffect(()=>{(async()=>{try{const w=await be(()=>import("./index-Dn0YtZ2R.js"),__vite__mapDeps([4,1,2,5,6]),import.meta.url);c({loaded:!0,api:Promise.resolve(w)})}catch(w){console.error("Failed to load mermaid library:",w),_(new Error(n("dialog.error.loadMermaid")))}})()},[]);const[m,v]=s.useState(()=>Qe(o)),[x,u]=s.useState(()=>[]),C=s.useDeferredValue(m.trim()),[U,_]=s.useState(null),d=Te();s.useEffect(()=>{v(Qe(o))},[o]),s.useEffect(()=>{(async()=>{try{const w=await r.api;let I;try{I=await w.parseMarkdownToDrawnix(C)}catch{I=await w.parseMarkdownToDrawnix(C.replace(/"/g,"'"))}const z=I;z.points=[[0,0]],z&&(u([z]),_(null))}catch(w){_(w)}})()},[C,r]);const j=()=>{if(!x.length)return;let f;const w=at(d);if(w)f=w;else{const z=st.getBoardContainer(d).getBoundingClientRect(),y=[z.width/4,z.height/2-20],b=d.viewport.zoom,p=rt(d),h=p[0]+y[0]/b,L=p[1]+y[1]/b;f=[h,L]}const I=x;d.insertFragment({elements:JSON.parse(JSON.stringify(I))},f,nt.paste),f&&requestAnimationFrame(()=>{ot(d,f)}),t({...a,openDialogType:null})};return e.jsxs(e.Fragment,{children:[e.jsx("div",{className:"ttd-dialog-desc",children:n("dialog.markdown.description")}),e.jsxs(dt,{children:[e.jsx(xe,{label:n("dialog.markdown.syntax"),children:e.jsx(ut,{input:m,placeholder:n("dialog.markdown.placeholder"),onChange:f=>v(f.target.value),onKeyboardSubmit:()=>{j()}})}),e.jsx(xe,{label:n("dialog.markdown.preview"),panelAction:{action:()=>{j()},label:n("dialog.markdown.insert")},renderSubmitShortcut:()=>e.jsx(pt,{}),children:e.jsx(mt,{value:x,loaded:r.loaded,error:U})})]})]})};function ht(){const{completedTasks:a}=ye(),t=s.useMemo(()=>a.filter(r=>{var c;return r.type===X.IMAGE&&((c=r.result)==null?void 0:c.url)}).map(r=>({id:r.id,type:"image",prompt:r.params.prompt,timestamp:r.completedAt||r.createdAt,imageUrl:r.result.url,width:r.result.width||1024,height:r.result.height||1024,uploadedImages:r.params.uploadedImages})).sort((r,c)=>c.timestamp-r.timestamp),[a]),n=s.useMemo(()=>a.filter(r=>{var c;return r.type===X.VIDEO&&((c=r.result)==null?void 0:c.url)}).map(r=>({id:r.id,type:"video",prompt:r.params.prompt,timestamp:r.completedAt||r.createdAt,imageUrl:r.result.thumbnailUrl||r.result.url,width:r.result.width||400,height:r.result.height||225,previewUrl:r.result.url,downloadUrl:r.result.url,uploadedImage:r.params.uploadedImage})).sort((r,c)=>c.timestamp-r.timestamp),[a]),o=s.useMemo(()=>[...t,...n].sort((r,c)=>c.timestamp-r.timestamp),[t,n]);return{imageHistory:t,videoHistory:n,allHistory:o}}const Xe=(a,t,n)=>{const o=n==="image"?{isGenerating:a,imageLoading:t}:{isGenerating:a,videoLoading:t};window.dispatchEvent(new CustomEvent("ai-generation-state-change",{detail:o}))},ft=(a,t,n)=>{s.useEffect(()=>{const o=r=>{(r.metaKey||r.ctrlKey)&&r.key==="Enter"&&(r.preventDefault(),!a&&t.trim()&&n())};return document.addEventListener("keydown",o),()=>{document.removeEventListener("keydown",o)}},[a,t,n])},gt=a=>{const[t,n]=s.useState(!1),[o,r]=s.useState(!1),c=s.useCallback(v=>{n(v),Xe(v,o,a)},[o,a]),m=s.useCallback(v=>{r(v),Xe(t,v,a)},[t,a]);return{isGenerating:t,isLoading:o,updateIsGenerating:c,updateIsLoading:m}},Da=(a,t,n)=>t==="image"?a==="zh"?"一只可爱的小猫坐在窗台上,阳光透过窗户洒在它的毛发上,背景是温馨的家居环境":"A cute kitten sitting on a windowsill, with sunlight streaming through the window onto its fur, with a cozy home environment in the background":n==="sora"?a==="zh"?"描述视频内容,输入 @ 可引用已创建的角色,如 @username 在海边漫步...":"Describe video content, type @ to reference created characters, e.g. @username walking on the beach...":a==="zh"?"生成一个美丽的日出场景,阳光从山峰后缓缓升起,云朵轻柔地飘动":"Generate a beautiful sunrise scene where the sun slowly rises from behind mountains with clouds gently floating",Na=[1,2,3,4,5,10,20,50,100],Ea="aitu_image_generation_quantity",Ta="aitu_video_generation_quantity",Ce=100,vt=({language:a,type:t,isGenerating:n,hasGenerated:o,canGenerate:r,onGenerate:c,onReset:m,leftContent:v})=>{const x=t==="video"?Ta:Ea,[u,C]=s.useState(()=>{try{const p=localStorage.getItem(x);if(p){const h=parseInt(p,10);if(!isNaN(h)&&h>=1&&h<=Ce)return h}}catch{}return 1}),[U,_]=s.useState(!1),[d,j]=s.useState(()=>u.toString()),f=s.useRef(null);s.useEffect(()=>{j(u.toString());try{localStorage.setItem(x,u.toString())}catch{}},[u,x]),s.useEffect(()=>{const p=h=>{f.current&&!f.current.contains(h.target)&&(_(!1),w())};return document.addEventListener("mousedown",p),()=>document.removeEventListener("mousedown",p)},[d]);const w=()=>{let p=parseInt(d,10);(isNaN(p)||p<1)&&(p=1),p>Ce&&(p=Ce),j(p.toString()),C(p)},I=p=>{const h=p.target.value;(h===""||/^\d*$/.test(h))&&j(h)},z=p=>{C(p),j(p.toString()),_(!1)},y=()=>{n||_(!U)},b=()=>{c(u)};return e.jsxs("div",{className:"section-actions unified-action-bar",children:[v&&e.jsx("div",{className:"action-bar-left",children:v}),e.jsxs("div",{className:`unified-action-box ${n?"is-generating":""} ${r?"can-generate":""}`,children:[e.jsxs("div",{className:"quantity-section",ref:f,children:[e.jsx("span",{className:"quantity-label",children:a==="zh"?"数量":"Count"}),e.jsxs("div",{className:`quantity-control ${U?"is-open":""} ${n?"is-disabled":""}`,children:[e.jsx("input",{type:"text",inputMode:"numeric",value:d,onChange:I,onBlur:w,"data-track":"ai_click_quantity_input",onClick:()=>!n&&_(!0),disabled:n,className:"quantity-input"}),e.jsx("button",{type:"button","data-track":"ai_click_quantity_toggle",onClick:p=>{p.stopPropagation(),y()},disabled:n,className:"quantity-toggle",children:e.jsx("svg",{width:"12",height:"12",viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"2",className:`quantity-icon ${U?"is-open":""}`,children:e.jsx("polyline",{points:"6 9 12 15 18 9"})})})]}),U&&e.jsxs("div",{className:"quantity-dropdown",children:[e.jsx("div",{className:"quantity-dropdown-header",children:a==="zh"?"选择数量":"Select Quantity"}),Na.map(p=>e.jsxs("button",{type:"button","data-track":"ai_click_quantity_select",onClick:()=>z(p),className:`quantity-option ${u===p?"is-selected":""}`,children:[e.jsxs("span",{children:[p," ",t==="video"?a==="zh"?"个":p>1?"videos":"video":a==="zh"?"张":p>1?"images":"image"]}),u===p&&e.jsx("svg",{width:"14",height:"14",viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"2",children:e.jsx("polyline",{points:"20 6 9 17 4 12"})})]},p))]})]}),e.jsx("div",{className:"action-divider"}),e.jsx("button",{"data-track":"ai_click_generate",onClick:b,disabled:n||!r,className:`generate-button ${n?"loading":""}`,children:n?a==="zh"?"生成中...":"Generating...":o?a==="zh"?"重新生成":"Regenerate":t==="video"?a==="zh"?"生成视频":"Generate Video":a==="zh"?"生成":"Generate"})]}),e.jsx("button",{"data-track":"ai_click_reset",onClick:m,disabled:n,className:"action-button secondary",children:a==="zh"?"重置":"Reset"})]})},xt=({error:a})=>a?e.jsx("div",{className:"form-error",children:a}):null,wt=({visible:a,query:t,position:n,showBelow:o=!1,selectedIndex:r,onSelect:c,onClose:m})=>{const{completedCharacters:v,isLoading:x}=it(),u=s.useRef(null),C=s.useMemo(()=>{if(!t)return v;const d=t.toLowerCase();return v.filter(j=>j.username.toLowerCase().includes(d))},[v,t]);s.useEffect(()=>{if(!a||!u.current)return;const d=u.current.querySelector(".character-mention-popup__item--selected");d&&d.scrollIntoView({block:"nearest"})},[a,r]),s.useEffect(()=>{if(!a)return;const d=j=>{u.current&&!u.current.contains(j.target)&&m()};return document.addEventListener("mousedown",d),()=>document.removeEventListener("mousedown",d)},[a,m]);const U=s.useCallback(d=>{c(d)},[c]);if(!a)return null;const _={position:"fixed",top:n.top,left:n.left,transform:o?"none":"translateY(-100%)",zIndex:1e4,maxHeight:"200px",overflowY:"auto"};return x?e.jsx("div",{ref:u,className:"character-mention-popup",style:_,children:e.jsx("div",{className:"character-mention-popup__empty",children:"加载中..."})}):C.length===0?e.jsx("div",{ref:u,className:"character-mention-popup",style:_,children:e.jsx("div",{className:"character-mention-popup__empty",children:t?`未找到 "${t}" 相关角色`:"暂无可用角色"})}):e.jsx("div",{ref:u,className:"character-mention-popup",style:_,children:C.map((d,j)=>e.jsxs("div",{className:`character-mention-popup__item ${j===r?"character-mention-popup__item--selected":""}`,onClick:()=>U(d),"data-track":"character_click_mention",children:[e.jsx("div",{className:"character-mention-popup__item-avatar",children:e.jsx($t,{characterId:d.id,profilePictureUrl:d.profilePictureUrl,alt:d.username})}),e.jsxs("span",{className:"character-mention-popup__item-name",children:["@",d.username]})]},d.id))})},Pa={visible:!1,query:"",position:{top:0,left:0},showBelow:!1,startIndex:-1,selectedIndex:0};function bt({enabled:a=!0,onPromptChange:t,prompt:n}){const[o,r]=s.useState(Pa),c=s.useRef(null),{completedCharacters:m}=it(),v=s.useCallback(d=>{if(!c.current)return{top:0,left:0,showBelow:!1};const j=c.current,f=j.getBoundingClientRect(),w=document.createElement("div"),I=window.getComputedStyle(j),z=["fontFamily","fontSize","fontWeight","fontStyle","letterSpacing","lineHeight","textTransform","wordSpacing","whiteSpace","paddingTop","paddingRight","paddingBottom","paddingLeft","borderTopWidth","borderRightWidth","borderBottomWidth","borderLeftWidth","boxSizing"];w.style.position="absolute",w.style.top="0",w.style.left="-9999px",w.style.visibility="hidden",w.style.whiteSpace="pre-wrap",w.style.overflowWrap="break-word",w.style.overflow="hidden",w.style.width=`${j.clientWidth}px`,z.forEach(E=>{w.style[E]=I.getPropertyValue(E.replace(/([A-Z])/g,"-$1").toLowerCase())}),document.body.appendChild(w);let y=0,b=0;try{const E=j.value.substring(0,d),D=document.createTextNode(E),T=document.createElement("span");T.textContent="",w.appendChild(D),w.appendChild(T);const P=T.getBoundingClientRect(),g=w.getBoundingClientRect();y=P.top-g.top,b=P.left-g.left}finally{document.body.removeChild(w)}const p=j.scrollTop,h=parseInt(I.lineHeight)||20;let L=f.top+y-p,N=f.left+b;const A=240,H=window.innerWidth;N+A>H-16&&(N=H-A-16),N<16&&(N=16);const S=L<220+16;return S?L=L+h+4:L=L-48,{top:L,left:N,showBelow:S}},[]),x=s.useCallback((d,j)=>{if(!a)return;const f=d.substring(0,j),w=f.lastIndexOf("@");if(w===-1){r(b=>({...b,visible:!1}));return}const I=w>0?d[w-1]:" ";if(!/\s/.test(I)&&w!==0){r(b=>({...b,visible:!1}));return}const z=f.substring(w+1);if(z.includes(" ")){r(b=>({...b,visible:!1}));return}const y=v(j);r({visible:!0,query:z,position:{top:y.top,left:y.left},showBelow:y.showBelow,startIndex:w,selectedIndex:0})},[a,v]),u=s.useCallback(d=>{var z;if(o.startIndex===-1)return;const j=n.substring(0,o.startIndex),f=((z=c.current)==null?void 0:z.selectionStart)||n.length,w=n.substring(f),I=`${j}@${d.username} ${w}`;t(I),r(y=>({...y,visible:!1})),setTimeout(()=>{if(c.current){const y=j.length+d.username.length+2;c.current.focus(),c.current.setSelectionRange(y,y)}},0)},[o.startIndex,n,t]),C=s.useCallback(d=>{if(!o.visible)return;const j=o.query?m.filter(f=>f.username.toLowerCase().includes(o.query.toLowerCase())):m;switch(d.key){case"ArrowDown":d.preventDefault(),r(f=>({...f,selectedIndex:Math.min(f.selectedIndex+1,j.length-1)}));break;case"ArrowUp":d.preventDefault(),r(f=>({...f,selectedIndex:Math.max(f.selectedIndex-1,0)}));break;case"Enter":case"Tab":j.length>0&&(d.preventDefault(),u(j[o.selectedIndex]));break;case"Escape":d.preventDefault(),r(f=>({...f,visible:!1}));break}},[o,m,u]),U=s.useCallback((d,j)=>{t(d),x(d,j)},[t,x]),_=s.useCallback(()=>{r(d=>({...d,visible:!1}))},[]);return{mentionState:o,setMentionState:r,textareaRef:c,completedCharacters:m,handleTextChange:U,handleKeyDown:C,handleCharacterSelect:u,closeMentionPopup:_,calculateMentionPosition:v}}const yt=({prompt:a,onPromptChange:t,presetPrompts:n,language:o,type:r,disabled:c=!1,onError:m,enableMention:v=!0,videoProvider:x})=>{const[u,C]=s.useState(!1),U=s.useRef(null),_=s.useRef(null),[d,j]=s.useState(null),[f,w]=s.useState(0),I=s.useMemo(()=>ge.sortPrompts(r,n).map((P,g)=>({id:`preset-${g}-${P.slice(0,20)}`,content:P,pinned:ge.isPinned(r,P)})),[r,n,f]),z=v&&r==="video"&&x==="sora",{mentionState:y,textareaRef:b,handleTextChange:p,handleKeyDown:h,handleCharacterSelect:L,closeMentionPopup:N}=bt({enabled:z,onPromptChange:t,prompt:a}),A=s.useCallback(()=>{if(_.current&&u){const T=_.current.getBoundingClientRect();j({top:T.top-4,left:T.right})}},[u]);s.useEffect(()=>{if(u)return A(),window.addEventListener("scroll",A,!0),window.addEventListener("resize",A),()=>{window.removeEventListener("scroll",A,!0),window.removeEventListener("resize",A)}},[u,A]),s.useEffect(()=>{const T=P=>{const g=P.target;if(U.current&&!U.current.contains(g)){const V=document.querySelector(".preset-prompt-panel-portal");V!=null&&V.contains(g)||C(!1)}};if(u)return document.addEventListener("mousedown",T),()=>document.removeEventListener("mousedown",T)},[u]);const H=s.useCallback(T=>{t(T),m==null||m(null),C(!1)},[t,m]),G=s.useCallback(T=>{const P=I.find(g=>g.id===T);P&&(P.pinned?ge.unpinPrompt(r,P.content):ge.pinPrompt(r,P.content),w(g=>g+1))},[r,I]),S=s.useCallback(T=>{const P=I.find(g=>g.id===T);P&&(ge.deletePrompt(r,P.content),w(g=>g+1))},[r,I]),E=s.useCallback(T=>{const P=T.target.value,g=T.target.selectionStart||0;p(P,g),m==null||m(null)},[p,m]);s.useEffect(()=>{r!=="video"&&N()},[r,N]);const D=()=>{if(!u||!d)return null;const T=o==="zh"?`${r==="image"?"图片":"视频"}描述预设`:`${r==="image"?"Image":"Video"} Description Presets`,P=e.jsx("div",{className:"preset-prompt-panel-portal",style:{position:"fixed",top:d.top,left:d.left,transform:"translate(-100%, -100%)",zIndex:Ut.DIALOG_POPOVER},children:e.jsx(Vt,{title:T,items:I,onSelect:H,onTogglePin:G,onDelete:S,language:o,disabled:c,showCount:!0})});return lt.createPortal(P,document.body)};return e.jsxs("div",{className:"form-field",children:[e.jsxs("div",{className:"form-label-with-icon",children:[e.jsx("label",{className:"form-label",children:o==="zh"?`${r==="image"?"图片":"视频"}描述`:`${r==="image"?"Image":"Video"} Description`}),e.jsx("div",{className:"textarea-with-preset",children:e.jsxs("div",{className:"preset-tooltip-container",ref:U,children:[e.jsx("button",{ref:_,type:"button",className:"preset-icon-button",disabled:c,onClick:()=>C(!u),children:"💡"}),D()]})})]}),e.jsx("textarea",{ref:b,className:"form-textarea",value:a,onChange:E,onKeyDown:h,placeholder:Da(o,r,x),rows:4,disabled:c}),z&&e.jsx(wt,{visible:y.visible,query:y.query,position:y.position,showBelow:y.showBelow,selectedIndex:y.selectedIndex,onSelect:L,onClose:N})]})};function Ma(a){return a.map(t=>t.prompt.trim()).filter(t=>t.length>0).filter((t,n,o)=>o.indexOf(t)===n)}const _t=(a,t,n)=>{const o=a==="image"?Ht(t):qt(t),r=Ma(n);return[...[...a==="video"?Bt():Gt(),...r].filter((x,u,C)=>C.indexOf(x)===u).slice(0,Wt),...o].filter((x,u,C)=>C.indexOf(x)===u).slice(0,Kt)},jt=(a,t,n)=>{!t||!t.trim()||(a==="video"?Yt(t.trim()):Jt(t.trim()))},ka=({model:a,duration:t,size:n,onDurationChange:o,onSizeChange:r,disabled:c=!1})=>{const m=De(a);s.useEffect(()=>{const u=Se(a);m.durationOptions.find(_=>_.value===t)||o(u.duration),m.sizeOptions.find(_=>_.value===n)||r(u.size)},[a]);const v=m.durationOptions.map(u=>({label:u.label,value:u.value})),x=m.sizeOptions.map(u=>({label:`${u.label} (${u.value})`,value:u.value}));return e.jsxs("div",{className:"video-model-options",children:[e.jsxs("div",{className:"video-model-options__row",children:[e.jsx("label",{className:"video-model-options__label",children:"时长"}),e.jsx("div",{className:"video-model-options__control",children:m.durationOptions.length===1?e.jsx("span",{className:"video-model-options__fixed-value",children:m.durationOptions[0].label}):e.jsx(Oe.Group,{value:t,onChange:u=>o(u),disabled:c,variant:"default-filled",size:"small",children:v.map(u=>e.jsx(Oe.Button,{value:u.value,children:u.label},u.value))})})]}),e.jsxs("div",{className:"video-model-options__row",children:[e.jsx("label",{className:"video-model-options__label",children:"尺寸"}),e.jsx("div",{className:"video-model-options__control",children:e.jsx(_e,{value:n,onChange:u=>r(u),disabled:c,size:"small",options:x,style:{width:"200px"}})})]})]})},It={label:"自动",value:"auto",width:0,height:0,description:"由模型自动决定最佳比例"},Ee=[It,{label:"1:1",value:"1:1",width:1,height:1,description:"正方形"},{label:"2:3",value:"2:3",width:2,height:3,description:"竖版标准"},{label:"3:2",value:"3:2",width:3,height:2,description:"横版标准"},{label:"3:4",value:"3:4",width:3,height:4,description:"竖版"},{label:"4:3",value:"4:3",width:4,height:3,description:"横版"},{label:"4:5",value:"4:5",width:4,height:5,description:"竖版社交"},{label:"5:4",value:"5:4",width:5,height:4,description:"横版"},{label:"9:16",value:"9:16",width:9,height:16,description:"竖屏全屏"},{label:"16:9",value:"16:9",width:16,height:9,description:"横屏全屏"},{label:"21:9",value:"21:9",width:21,height:9,description:"超宽屏"}],Ze="auto";function Ra(a){return Ee.find(t=>t.value===a)}const Oa=({value:a,onChange:t,compact:n=!0})=>{const{language:o}=he(),[r,c]=s.useState(!1),m=s.useRef(null),v=s.useMemo(()=>a==="auto"?It:Ra(a),[a]);s.useEffect(()=>{const u=C=>{m.current&&!m.current.contains(C.target)&&c(!1)};return r&&document.addEventListener("mousedown",u),()=>{document.removeEventListener("mousedown",u)}},[r]);const x=u=>{t(u.value),c(!1)};return n?e.jsxs("div",{className:"aspect-ratio-selector aspect-ratio-selector--compact",ref:m,children:[e.jsx("div",{className:"aspect-ratio-selector__label",children:o==="zh"?"比例":"Ratio"}),e.jsxs("div",{className:`aspect-ratio-selector__trigger ${r?"aspect-ratio-selector__trigger--open":""}`,"data-track":"ai_click_ratio_toggle",onClick:()=>c(!r),children:[e.jsx("span",{className:"aspect-ratio-selector__trigger-value",children:(v==null?void 0:v.label)||a}),e.jsx("span",{className:`aspect-ratio-selector__trigger-icon ${r?"aspect-ratio-selector__trigger-icon--open":""}`,children:"▼"})]}),r&&e.jsx("div",{className:"aspect-ratio-selector__dropdown",children:e.jsx("div",{className:"aspect-ratio-selector__dropdown-grid",children:Ee.map(u=>e.jsx(Ae,{content:u.description,theme:"light",placement:"top",children:e.jsx("div",{className:`aspect-ratio-selector__dropdown-item ${a===u.value?"aspect-ratio-selector__dropdown-item--selected":""}`,"data-track":"ai_click_ratio_select",onClick:()=>x(u),children:u.label})},u.value))})})]}):e.jsxs("div",{className:"aspect-ratio-selector",children:[e.jsx("div",{className:"aspect-ratio-selector__label",children:o==="zh"?"图片比例":"Aspect Ratio"}),e.jsx("div",{className:"aspect-ratio-selector__options",children:Ee.map(u=>e.jsx(Ae,{content:u.description,theme:"light",placement:"top",children:e.jsx("div",{className:`aspect-ratio-selector__option ${a===u.value?"aspect-ratio-selector__option--selected":""}`,"data-track":"ai_click_ratio_select",onClick:()=>t(u.value),children:e.jsx("span",{className:"aspect-ratio-selector__option-ratio",children:u.label})})},u.value))})]})};function Ct(){return`scene-${Date.now()}-${Math.random().toString(36).substr(2,9)}`}function et(a,t){return{id:Ct(),order:a,duration:t,prompt:""}}function Aa(a,t,n=1){if(a.length===0)return{valid:!1,error:"至少需要一个场景"};for(const r of a){if(r.duration<n)return{valid:!1,error:`场景 ${r.order} 时长不能少于 ${n} 秒`};if(r.duration>t)return{valid:!1,error:`场景 ${r.order} 时长不能超过 ${t} 秒`}}const o=a.find(r=>!r.prompt.trim());return o?{valid:!1,error:`场景 ${o.order} 需要填写提示词`}:{valid:!0}}function za(a){return a.sort((t,n)=>t.order-n.order).map((t,n)=>`Shot ${n+1}:
|
|
44
|
+
duration: ${t.duration}sec
|
|
45
|
+
Scene: ${t.prompt.trim()}`).join(`
|
|
46
|
+
|
|
47
|
+
`)}function La(a){const t=/Shot\s+(\d+):\s*\n\s*duration:\s*([\d.]+)\s*sec\s*\n\s*Scene:\s*([^\n]+(?:\n(?!Shot\s+\d+:)[^\n]*)*)/gi,n=[];let o;for(;(o=t.exec(a))!==null;){const r=parseInt(o[1],10),c=parseFloat(o[2]),m=o[3].trim();n.push({id:Ct(),order:r,duration:c,prompt:m})}return n.length===0?null:n.sort((r,c)=>r.order-c.order)}const Fa=({value:a,onChange:t,placeholder:n,disabled:o=!1,autoFocus:r=!1,enableMention:c=!0})=>{const{mentionState:m,textareaRef:v,handleTextChange:x,handleKeyDown:u,handleCharacterSelect:C,closeMentionPopup:U}=bt({enabled:c,onPromptChange:t,prompt:a}),_=s.useCallback(d=>{const j=d.target.value,f=d.target.selectionStart||0;x(j,f)},[x]);return s.useEffect(()=>{r&&v.current&&v.current.focus()},[r,v]),e.jsxs("div",{className:"scene-prompt-input",children:[e.jsx("textarea",{ref:v,className:"scene-prompt-input__textarea",value:a,onChange:_,onKeyDown:u,placeholder:n,disabled:o,rows:3}),c&&e.jsx(wt,{visible:m.visible,query:m.query,position:m.position,showBelow:m.showBelow,selectedIndex:m.selectedIndex,onSelect:C,onClose:U})]})},$a=({enabled:a,onEnabledChange:t,totalDuration:n,maxScenes:o,minSceneDuration:r,scenes:c,onScenesChange:m,disabled:v=!1})=>{const[x,u]=s.useState(null),C=s.useRef(null);s.useEffect(()=>{a&&c.length>0&&!x&&u(c[0].id)},[a,c,x]);const U=s.useCallback(()=>{if(c.length>=o)return;const b=c.reduce((N,A)=>N+A.duration,0),p=n-b;let h=Math.max(r,p/2);h=parseFloat(h.toFixed(1)),h<r&&(h=r);const L=et(c.length+1,h);m([...c,L]),u(L.id),setTimeout(()=>{var N;(N=C.current)==null||N.scrollIntoView({behavior:"smooth"})},100)},[c,o,n,r,m]),_=s.useCallback(b=>{var L;if(c.length<=1)return;const h=c.filter(N=>N.id!==b).map((N,A)=>({...N,order:A+1}));m(h),x===b&&u(((L=h[0])==null?void 0:L.id)||null)},[c,m,x]),d=s.useCallback(b=>{const p=c.filter(h=>h.id!==b).reduce((h,L)=>h+L.duration,0);return Math.max(r,n-p)},[c,n,r]),j=s.useCallback(b=>{const p=d(b),h=[],L=.1;for(let N=r;N<=p+.001;N+=L){const A=parseFloat(N.toFixed(1));A<=p&&h.push({label:`${A}`,value:A})}return h},[r,d]),f=s.useCallback((b,p)=>{const h=typeof p=="string"?parseFloat(p):p;if(isNaN(h))return;const L=d(b),N=c.map(A=>{if(A.id===b){const H=Math.max(r,Math.min(h,L)),G=parseFloat(H.toFixed(1));return{...A,duration:G}}return A});m(N)},[c,r,d,m]),w=s.useCallback((b,p)=>{const h=c.map(L=>L.id===b?{...L,prompt:p}:L);m(h)},[c,m]),I=s.useCallback(b=>{if(t(b),b&&c.length===0){const p=et(1,n);m([p]),u(p.id)}},[c,n,t,m]),z=s.useCallback(b=>{u(b)},[]),y=c.length<o;return e.jsxs("div",{className:"storyboard-editor",children:[e.jsxs("div",{className:"storyboard-editor__header",children:[e.jsxs("div",{className:"storyboard-editor__toggle",children:[e.jsx(Qt,{value:a,onChange:I,disabled:v,size:"small"}),e.jsxs("div",{className:"storyboard-editor__title",children:[e.jsx("span",{className:"storyboard-editor__title-text",children:"故事场景模式"}),e.jsx("span",{className:"storyboard-editor__title-desc",children:"定义多个场景及其时长"})]})]}),a&&e.jsx("span",{className:"storyboard-editor__new-badge",children:"NEW"})]}),a&&e.jsxs("div",{className:"storyboard-editor__content",children:[e.jsxs("div",{className:"storyboard-editor__section-header",children:[e.jsx("span",{className:"storyboard-editor__section-title",children:"场景列表"}),e.jsxs("span",{className:"storyboard-editor__section-hint",children:["共 ",c.length," 个场景,已用 ",c.reduce((b,p)=>b+p.duration,0).toFixed(1)," 秒 / 总时长 ",n," 秒"]})]}),e.jsxs("div",{className:"storyboard-editor__scenes",children:[c.map((b,p)=>{const h=x===b.id,L=p===c.length-1;return e.jsxs("div",{className:`storyboard-editor__scene-wrapper ${h?"is-selected":""}`,children:[e.jsx("div",{className:`storyboard-editor__timeline-line ${L?"is-last":""}`}),e.jsx("div",{className:`storyboard-editor__timeline-node ${h?"is-selected":""}`,children:h?p+1:""}),!h&&e.jsxs("div",{className:"storyboard-editor__scene storyboard-editor__scene--compact",onClick:()=>z(b.id),children:[e.jsx("span",{className:"storyboard-editor__scene-index",children:p+1}),e.jsx("div",{className:"storyboard-editor__scene-preview",children:e.jsx("p",{className:"storyboard-editor__scene-preview-text",children:b.prompt||"暂无场景描述..."})}),e.jsxs("div",{className:"storyboard-editor__scene-duration-badge",children:[e.jsx(Ne,{size:"12px"}),e.jsxs("span",{children:[b.duration,"s"]})]}),e.jsx(ct,{className:"storyboard-editor__scene-arrow",size:"14px"})]}),h&&e.jsxs("div",{className:"storyboard-editor__scene storyboard-editor__scene--expanded",children:[e.jsxs("div",{className:"storyboard-editor__scene-header",children:[e.jsx("div",{className:"storyboard-editor__scene-info",children:e.jsxs("span",{className:"storyboard-editor__scene-label",children:[e.jsx("span",{className:"storyboard-editor__active-indicator"}),"场景 ",p+1]})}),e.jsxs("div",{className:"storyboard-editor__scene-controls",children:[e.jsx(Ne,{className:"storyboard-editor__time-icon"}),e.jsx(_e,{value:parseFloat(b.duration.toFixed(1)),onChange:N=>f(b.id,N),disabled:v,className:"storyboard-editor__duration-select",size:"small",options:j(b.id),filterable:!0,creatable:!0,popupProps:{overlayClassName:"storyboard-editor__duration-popup"}}),c.length>1&&e.jsx(de,{theme:"default",variant:"text",size:"small",icon:e.jsx(Xt,{}),onClick:N=>{N.stopPropagation(),_(b.id)},disabled:v,className:"storyboard-editor__scene-delete"})]})]}),e.jsx("div",{className:"storyboard-editor__scene-prompt",children:e.jsx(Fa,{value:b.prompt,onChange:N=>w(b.id,N),placeholder:`描述场景 ${p+1} 的内容,输入 @ 可引用角色`,disabled:v,autoFocus:!0,enableMention:!0})})]})]},b.id)}),e.jsx("div",{ref:C})]}),y&&e.jsx(de,{theme:"default",variant:"dashed",size:"medium",icon:e.jsx(Zt,{}),onClick:U,disabled:v,className:"storyboard-editor__add-btn",block:!0,children:"添加场景"})]})]})},St=({images:a,onImagesChange:t,language:n="zh",disabled:o=!1,multiple:r=!0,maxCount:c=10,label:m,slotLabels:v,onError:x})=>{const[u,C]=s.useState(!1),[U,_]=s.useState(!1),[d,j]=s.useState(0),f=s.useRef(null),w=s.useRef(null),{addAsset:I}=ea(),y={zh:{local:"本地",library:"素材库",dragHint:"拖拽图片到此处",pasteHint:"或 Ctrl+V 粘贴",invalidFile:"请上传图片文件",fileTooLarge:"图片大小不能超过 10MB",someFilesInvalid:"部分文件格式不支持或超过10MB限制",loadFailed:"加载图片失败",maxCountReached:"最多上传 {count} 张图片"},en:{local:"Local",library:"Library",dragHint:"Drop images here",pasteHint:"or Ctrl+V to paste",invalidFile:"Please upload image files",fileTooLarge:"Image size cannot exceed 10MB",someFilesInvalid:"Some files are not supported or exceed 10MB limit",loadFailed:"Failed to load image",maxCountReached:"Maximum {count} images allowed"}}[n],b=s.useCallback(i=>i.type.startsWith("image/")?i.size>10*1024*1024?(Q.error(y.fileTooLarge),!1):!0:(Q.error(y.invalidFile),!1),[y]),p=s.useCallback(i=>new Promise((l,k)=>{const R=new FileReader;R.onload=()=>{l({url:R.result,name:i.name,file:i})},R.onerror=k,R.readAsDataURL(i)}),[]),h=s.useCallback(async(i,l)=>{const R=Array.from(i).filter(b);if(R.length!==0){r&&a.length+R.length>c&&(Q.warning(y.maxCountReached.replace("{count}",String(c))),R.splice(c-a.length)),R.forEach(O=>{I(O,ze.IMAGE,ta.LOCAL,O.name).catch(q=>{console.warn("[ReferenceImageUpload] Failed to add asset to library:",q)})});try{const O=await Promise.all(R.map(p));if(v&&l!==void 0){const q=[...a];q[l]=O[0],t(q.filter(Boolean))}else t(r?[...a,...O]:O.slice(0,1));x==null||x(null)}catch(O){console.error("[ReferenceImageUpload] Failed to process files:",O),x==null||x(y.loadFailed)}}},[a,r,c,v,b,p,I,t,x,y]),L=s.useCallback(i=>{const l=i.target.files;l&&l.length>0&&h(l,v?d:void 0),i.target.value=""},[h,v,d]),N=s.useCallback(async i=>{try{const k=await(await fetch(i.url)).blob(),R=new FileReader;R.onload=()=>{const O={url:R.result,name:i.name};if(v){const q=[...a];q[d]=O,t(q.filter(Boolean))}else if(r){if(a.length>=c){Q.warning(y.maxCountReached.replace("{count}",String(c)));return}t([...a,O])}else t([O]);C(!1),x==null||x(null)},R.readAsDataURL(k)}catch(l){console.error("[ReferenceImageUpload] Failed to convert asset to base64:",l),x==null||x(y.loadFailed),C(!1)}},[a,r,c,v,d,t,x,y]),A=s.useCallback(i=>{i.preventDefault(),i.stopPropagation(),o||_(!0)},[o]),H=s.useCallback(i=>{var k;i.preventDefault(),i.stopPropagation();const l=(k=f.current)==null?void 0:k.getBoundingClientRect();if(l){const{clientX:R,clientY:O}=i;(R<l.left||R>l.right||O<l.top||O>l.bottom)&&_(!1)}},[]),G=s.useCallback(i=>{i.preventDefault(),i.stopPropagation()},[]),S=s.useCallback((i,l)=>{if(i.preventDefault(),i.stopPropagation(),_(!1),o)return;const k=i.dataTransfer.files;k&&k.length>0&&h(k,l)},[o,h]);s.useEffect(()=>{const i=async l=>{var le;if(o)return;const k=document.activeElement,R=f.current;if(!R||!(R.contains(k)||k===document.body||(k==null?void 0:k.tagName)==="BODY"))return;const q=(le=l.clipboardData)==null?void 0:le.items;if(!q)return;const ae=[];for(let re=0;re<q.length;re++){const se=q[re];if(se.type.startsWith("image/")){const oe=se.getAsFile();oe&&ae.push(oe)}}ae.length>0&&(l.preventDefault(),h(ae))};return document.addEventListener("paste",i),()=>{document.removeEventListener("paste",i)}},[o,h]);const E=s.useCallback(i=>{const l=a.filter((k,R)=>R!==i);t(l)},[a,t]),D=s.useCallback(i=>{var l;i!==void 0&&j(i),(l=w.current)==null||l.click()},[]),T=s.useCallback(i=>{i!==void 0&&j(i),C(!0)},[]),P=i=>e.jsx("div",{className:`reference-image-upload__placeholder ${U?"reference-image-upload__placeholder--dragging":""}`,onDragEnter:A,onDragLeave:H,onDragOver:G,onDrop:l=>S(l,i),children:e.jsxs("div",{className:"reference-image-upload__buttons",children:[e.jsx(de,{variant:"outline",icon:e.jsx(Le,{size:16}),onClick:()=>D(i),disabled:o,"data-track":"reference_image_upload_local",className:"reference-image-upload__btn",children:y.local}),e.jsx(de,{variant:"outline",icon:e.jsx(Fe,{size:16}),onClick:()=>T(i),disabled:o,"data-track":"reference_image_upload_library",className:"reference-image-upload__btn",children:y.library})]})}),g=(i,l)=>e.jsxs("div",{className:"reference-image-upload__preview",children:[e.jsx("img",{src:i.url,alt:i.name,className:"reference-image-upload__image"}),e.jsx("button",{type:"button",className:"reference-image-upload__remove",onClick:()=>E(l),disabled:o,"data-track":"reference_image_upload_remove",children:e.jsx(ra,{size:14})}),v&&v[l]&&e.jsx("div",{className:"reference-image-upload__slot-label",children:v[l]})]},l),V=()=>v?e.jsx("div",{className:"reference-image-upload__slots",children:v.map((i,l)=>{const k=a[l];return e.jsxs("div",{className:"reference-image-upload__slot",children:[e.jsx("div",{className:"reference-image-upload__slot-title",children:i}),k?g(k,l):e.jsx("div",{className:`reference-image-upload__slot-placeholder ${U?"reference-image-upload__slot-placeholder--dragging":""}`,onDragEnter:A,onDragLeave:H,onDragOver:G,onDrop:R=>S(R,l),children:e.jsxs("div",{className:"reference-image-upload__slot-buttons",children:[e.jsx(de,{variant:"outline",icon:e.jsx(Le,{size:16}),onClick:()=>D(l),disabled:o,"data-track":"reference_image_upload_slot_local",className:"reference-image-upload__slot-btn",children:y.local}),e.jsx(de,{variant:"outline",icon:e.jsx(Fe,{size:16}),onClick:()=>T(l),disabled:o,"data-track":"reference_image_upload_slot_library",className:"reference-image-upload__slot-btn",children:y.library})]})})]},l)})}):null,$=()=>{const i=r&&a.length<c;return e.jsxs("div",{className:"reference-image-upload__grid",children:[a.map((l,k)=>g(l,k)),i&&P(),a.length===0&&!i&&P()]})},K=()=>a.length>0?e.jsxs("div",{className:"reference-image-upload__single",children:[g(a[0],0),e.jsx("div",{className:"reference-image-upload__replace",children:P()})]}):P();return e.jsxs("div",{ref:f,className:`reference-image-upload ${o?"reference-image-upload--disabled":""}`,tabIndex:0,children:[m&&e.jsx("div",{className:"reference-image-upload__label",children:m}),e.jsx("input",{ref:w,type:"file",accept:"image/*",multiple:r&&!v,onChange:L,className:"reference-image-upload__input",disabled:o}),v?V():r?$():K(),e.jsx(aa,{isOpen:u,onClose:()=>C(!1),mode:sa.SELECT,filterType:ze.IMAGE,onSelect:N})]})},Dt=({taskIds:a,taskType:t,onEditTask:n})=>{var K;const{tasks:o,retryTask:r,deleteTask:c}=ye(),{board:m,openDialog:v}=we(),[x,u]=s.useState(!1),[C,U]=s.useState(null),[_,d]=s.useState(null),[j,f]=s.useState(""),[w,I]=s.useState(null),z=(i,l)=>{var ae,le,re,se,oe,ue,fe,M,F,B;if(!l.trim())return!0;const k=l.toLowerCase().split(/\s+/).filter(Boolean),R={[pe.PENDING]:"待处理",[pe.PROCESSING]:"处理中",[pe.COMPLETED]:"已完成",[pe.FAILED]:"失败",[pe.CANCELLED]:"已取消"},O=[];O.push(((ae=i.params)==null?void 0:ae.prompt)??""),O.push(((le=i.params)==null?void 0:le.model)??""),O.push(i.id??""),O.push(R[i.status]??String(i.status)),(re=i.params)!=null&&re.batchId&&O.push(String(i.params.batchId)),(se=i.params)!=null&&se.batchIndex&&O.push(String(i.params.batchIndex)),(oe=i.params)!=null&&oe.batchTotal&&O.push(String(i.params.batchTotal)),(ue=i.result)!=null&&ue.format&&O.push(String(i.result.format)),(fe=i.result)!=null&&fe.width&&((M=i.result)!=null&&M.height)?O.push(`${i.result.width}x${i.result.height}`):(F=i.params)!=null&&F.width&&((B=i.params)!=null&&B.height)&&O.push(`${i.params.width}x${i.params.height}`);const q=O.join(" ").toLowerCase();return k.every(W=>q.includes(W))},y=s.useMemo(()=>{let i=o;return a&&a.length>0&&(i=i.filter(l=>a.includes(l.id))),t!==void 0&&(i=i.filter(l=>l.type===t)),j.trim()&&(i=i.filter(l=>z(l,j))),i.sort((l,k)=>k.createdAt-l.createdAt)},[o,a,t,j]),b=i=>{r(i)},p=i=>{U(i),u(!0)},h=()=>{C&&c(C),u(!1),U(null)},L=async i=>{var R;const l=o.find(O=>O.id===i);if(!((R=l==null?void 0:l.result)!=null&&R.url))return;const k=`${ma(l.params.prompt)||l.type}.${l.result.format}`;try{const O=await pa.getCachedBlob(l.result.url);if(O){ha(O,k),Q.success("下载成功");return}const q=await fa(l.result.url,l.params.prompt,l.result.format,l.type);q&&"opened"in q?Q.success("已在新标签页打开,请右键另存为"):Q.success("下载成功")}catch(O){console.error("Download failed:",O),Q.error("下载失败,请稍后重试")}},N=async i=>{var k;const l=o.find(R=>R.id===i);if(!((k=l==null?void 0:l.result)!=null&&k.url)||!m){console.warn("Cannot insert: task result or board not available"),Q.warning("无法插入:白板未就绪");return}try{l.type===X.IMAGE?(await da(m,l.result.url),Q.success("图片已插入到白板")):l.type===X.VIDEO&&(await ua(m,l.result.url),Q.success("视频已插入到白板"))}catch(R){console.error("Failed to insert to board:",R),Q.error(`插入失败: ${R instanceof Error?R.message:"未知错误"}`)}},A=i=>{var k,R;const l=o.find(O=>O.id===i);if(!l){console.warn("Cannot edit: task not found");return}if(n){n(l);return}if(l.type===X.IMAGE){const O={initialPrompt:l.params.prompt,initialWidth:l.params.width,initialHeight:l.params.height,initialImages:l.params.uploadedImages,initialResultUrl:(k=l.result)==null?void 0:k.url};v(ee.aiImageGeneration,O)}else if(l.type===X.VIDEO){const O={initialPrompt:l.params.prompt,initialDuration:typeof l.params.seconds=="string"?parseInt(l.params.seconds,10):l.params.seconds,initialModel:l.params.model,initialSize:l.params.size,initialImages:l.params.uploadedImages,initialResultUrl:(R=l.result)==null?void 0:R.url};v(ee.aiVideoGeneration,O)}},H=i=>{const l=o.find(k=>k.id===i);l&&I(l)},G=s.useMemo(()=>y.filter(i=>{var l;return i.status===pe.COMPLETED&&((l=i.result)==null?void 0:l.url)}),[y]),S=s.useMemo(()=>{if(!_)return null;const i=G.findIndex(l=>l.id===_);return i===-1?null:{currentIndex:i,total:G.length,hasPrevious:i>0,hasNext:i<G.length-1}},[_,G]),E=i=>{d(i)},D=()=>{d(null)},T=()=>{!S||!S.hasPrevious||d(G[S.currentIndex-1].id)},P=()=>{!S||!S.hasNext||d(G[S.currentIndex+1].id)},g=s.useMemo(()=>_?o.find(i=>i.id===_):null,[_,o]);s.useEffect(()=>{if(!_)return;const i=l=>{l.key==="ArrowLeft"||l.key==="ArrowUp"?(l.preventDefault(),T()):l.key==="ArrowRight"||l.key==="ArrowDown"?(l.preventDefault(),P()):l.key==="Escape"&&(l.preventDefault(),D())};return window.addEventListener("keydown",i),()=>window.removeEventListener("keydown",i)},[_,S]);const V=s.useMemo(()=>{let i=o;return a&&a.length>0&&(i=i.filter(l=>a.includes(l.id))),t!==void 0&&(i=i.filter(l=>l.type===t)),i.length},[o,a,t]),$=j.trim()&&y.length===0&&V>0;return e.jsxs(e.Fragment,{children:[e.jsxs("div",{className:"dialog-task-list",children:[e.jsxs("div",{className:"dialog-task-list__header",style:{display:"flex",alignItems:"center",gap:8,justifyContent:"space-between"},children:[e.jsxs("h4",{children:["生成任务 (",y.length,")"]}),e.jsx("div",{style:{minWidth:"180px",maxWidth:"240px",flexShrink:0},children:e.jsx(na,{value:j,onChange:i=>f(i),placeholder:"搜索任务(提示词/模型/...)",clearable:!0,prefixIcon:e.jsx(oa,{}),size:"small"})})]}),e.jsx(ia,{tasks:y,onRetry:b,onDelete:p,onDownload:L,onInsert:N,onEdit:A,onPreviewOpen:E,onExtractCharacter:H,className:"dialog-task-list__content",emptyContent:e.jsx("div",{className:"dialog-task-list__empty",children:$?e.jsx("p",{children:"未找到匹配的任务"}):e.jsx("p",{children:"暂无生成任务"})})})]}),e.jsx($e,{visible:x,header:"确认删除",onClose:()=>u(!1),onConfirm:h,onCancel:()=>u(!1),children:"确定要删除此任务吗?此操作无法撤销。"}),g&&((K=g.result)==null?void 0:K.url)&&e.jsx($e,{visible:!!_,onClose:D,width:"90vw",header:e.jsxs("div",{style:{display:"flex",justifyContent:"space-between",alignItems:"center"},children:[e.jsx("span",{children:g.type===X.IMAGE?"图片预览":g.type===X.CHARACTER?"角色预览":"视频预览"}),S&&e.jsxs("span",{style:{fontSize:"14px",color:"#757575",fontWeight:"normal"},children:[S.currentIndex+1," / ",S.total]})]}),footer:null,className:"task-preview-dialog",children:e.jsxs("div",{className:"task-preview-container",children:[e.jsx(de,{className:"task-preview-nav task-preview-nav--left",icon:e.jsx(la,{}),"data-track":"task_click_preview_previous",onClick:T,size:"large",shape:"circle",variant:"outline",disabled:!(S!=null&&S.hasPrevious)}),e.jsx(Ua,{task:g}),e.jsx(de,{className:"task-preview-nav task-preview-nav--right",icon:e.jsx(ct,{}),"data-track":"task_click_preview_next",onClick:P,size:"large",shape:"circle",variant:"outline",disabled:!(S!=null&&S.hasNext)})]})}),e.jsx(ca,{visible:!!w,task:w,onClose:()=>I(null),onCreateComplete:i=>{I(null)}})]})},Ua=({task:a})=>{var o;const{url:t,isFromCache:n}=ga(a.id,(o=a.result)==null?void 0:o.url);return t?e.jsxs("div",{className:"task-preview-content",children:[a.type===X.IMAGE||a.type===X.CHARACTER?e.jsx("img",{src:t,alt:"Preview",style:{maxWidth:"100%",maxHeight:"85vh",objectFit:"contain"}},a.id):e.jsx("video",{src:t,controls:!0,autoPlay:!0,style:{maxWidth:"100%",maxHeight:"85vh"}},a.id),n&&e.jsx("div",{className:"task-preview-cache-badge",children:"已缓存"})]}):e.jsx("div",{className:"task-preview-content",children:"加载中..."})},Va=({initialPrompt:a="",initialImages:t=[],selectedElementIds:n=[],initialWidth:o,initialHeight:r,initialResultUrl:c,selectedModel:m,onModelChange:v}={})=>{const[x,u]=s.useState(a),[C,U]=s.useState(o||1024),[_,d]=s.useState(r||1024),[j,f]=s.useState(Ze),[w,I]=s.useState(null),[z,y]=s.useState(t),{imageHistory:b}=ht(),{isGenerating:p}=gt("image"),{language:h}=he(),{createTask:L}=ye(),[N,A]=s.useState(!1),H=ne.useRef("");s.useEffect(()=>{if(N)return;const g=JSON.stringify({prompt:a,images:t==null?void 0:t.map(V=>V.url),elementIds:n,width:o,height:r,result:c});H.current!==g&&(H.current=g,u(a),y(t||[]),o&&U(o),r&&d(r))},[a,t,n,o,r,c,N]),s.useEffect(()=>(I(null),()=>{I(null)}),[]);const G=()=>{u(""),y([]),I(null),f(Ze),A(!1),window.dispatchEvent(new CustomEvent("ai-image-clear"))},S=ne.useMemo(()=>_t("image",h,b),[b,h]),E=g=>{jt("image",g)},D=g=>{if(A(!0),u(g.params.prompt||""),U(g.params.width||1024),d(g.params.height||1024),g.params.uploadedImages&&g.params.uploadedImages.length>0?y(g.params.uploadedImages):y([]),g.params.model){const V=J.get();J.update({...V,imageModelName:g.params.model})}g.params.aspectRatio&&f(g.params.aspectRatio),I(null)},T=async()=>Promise.all(z.map(async g=>{if(g.file)return new Promise((V,$)=>{const K=new FileReader;K.onload=()=>{V({type:"url",url:K.result,name:g.name})},K.onerror=$,K.readAsDataURL(g.file)});if(g.url)return{type:"url",url:g.url,name:g.name};throw new Error("Invalid image data")})),P=async(g=1)=>{if(!x.trim()){I(h==="zh"?"请输入图像描述":"Please enter image description");return}if(!J.get().apiKey&&!await xa()){I(h==="zh"?"需要 API Key 才能生成图片":"API Key is required to generate images");return}try{const $=typeof C=="string"?parseInt(C)||1024:C,K=typeof _=="string"?parseInt(_)||1024:_,i=await T();if(g>1){const q=[],ae=`batch_${Date.now()}`,re=J.get().imageModelName||"gemini-3-pro-image-preview-vip";for(let se=0;se<g;se++){const oe={prompt:x.trim(),width:$,height:K,aspectRatio:j,model:re,uploadedImages:i,batchId:ae,batchIndex:se+1,batchTotal:g,autoInsertToCanvas:!0},ue=L(oe,X.IMAGE);ue&&q.push(ue.id)}q.length>0?(Q.success(h==="zh"?`已添加 ${q.length} 个任务到队列`:`Added ${q.length} tasks to queue`),E(x),I(null),A(!1)):I(h==="zh"?"批量任务创建失败,请稍后重试":"Failed to create batch tasks, please try again later");return}const k=J.get().imageModelName||"gemini-2.5-flash-image-vip",R={prompt:x.trim(),width:$,height:K,aspectRatio:j,model:k,uploadedImages:i,autoInsertToCanvas:!0};L(R,X.IMAGE)?(Q.success(h==="zh"?"任务已添加到队列,将在后台生成":"Task added to queue, will be generated in background"),E(x),I(null),A(!1)):I(h==="zh"?"任务创建失败,请检查参数或稍后重试":"Failed to create task, please check parameters or try again later")}catch($){console.error("Failed to create task:",$);let K=h==="zh"?"任务创建失败,请检查参数或稍后重试":"Failed to create task, please check parameters or try again later";$.message&&($.message.includes("exceed 5000 characters")?K=h==="zh"?"提示词不能超过 5000 字符":"Prompt must not exceed 5000 characters":$.message.includes("Duplicate submission")?K=h==="zh"?"请勿重复提交,请等待 5 秒后再试":"Duplicate submission. Please wait 5 seconds.":$.message.includes("Invalid parameters")&&(K=h==="zh"?`参数错误: ${$.message.replace("Invalid parameters: ","")}`:$.message)),I(K)}};return ft(p,x,()=>P(1)),e.jsx("div",{className:"ai-image-generation-container",children:e.jsxs("div",{className:"main-content",children:[e.jsxs("div",{className:"ai-image-generation-section",children:[e.jsxs("div",{className:"ai-image-generation-form",children:[m!==void 0&&v&&e.jsx("div",{className:"form-header-row",children:e.jsx("div",{className:"model-selector-wrapper",children:e.jsx(_e,{value:m,onChange:g=>v(g),options:va,size:"small",placeholder:h==="zh"?"选择图片模型":"Select Image Model",filterable:!0,creatable:!0,disabled:p})})}),e.jsx(St,{images:z,onImagesChange:y,language:h,disabled:p,multiple:!0,label:h==="zh"?"参考图片 (可选)":"Reference Images (Optional)",onError:I}),e.jsx(yt,{prompt:x,onPromptChange:u,presetPrompts:S,language:h,type:"image",disabled:p,onError:I}),e.jsx(xt,{error:w})]}),e.jsx(vt,{language:h,type:"image",isGenerating:p,hasGenerated:!1,canGenerate:!!x.trim(),onGenerate:P,onReset:G,leftContent:e.jsx(Oa,{value:j,onChange:f,compact:!0})})]}),e.jsx("div",{className:"task-sidebar",children:e.jsx(Dt,{taskType:X.IMAGE,onEditTask:D})})]})})},Ba=({initialPrompt:a="",initialImage:t,initialImages:n,initialDuration:o,initialModel:r,initialSize:c,initialResultUrl:m,selectedModel:v,onModelChange:x}={})=>{const[u,C]=s.useState(a),[U,_]=s.useState(null),[d,j]=s.useState(()=>{const M=J.get();return r||M.videoModelName||"veo3"}),f=ne.useMemo(()=>De(d),[d]),w=ne.useMemo(()=>Se(d),[d]),[I,z]=s.useState((o==null?void 0:o.toString())||w.duration),[y,b]=s.useState(c||w.size),[p,h]=s.useState(()=>n&&n.length>0?n:t?[{slot:0,slotLabel:"参考图",url:t.url||"",name:t.name,file:t.file}]:[]),[L,N]=s.useState(()=>{const M=f.imageUpload.maxCount,F=f.imageUpload.labels||[];let B=[];return n&&n.length>0?B=n:t&&(B=[{slot:0,slotLabel:F[0]||"参考图",url:t.url||"",name:t.name,file:t.file}]),B.slice(0,M).map((W,Y)=>({...W,slot:Y,slotLabel:F[Y]||`参考图${Y+1}`}))}),[A,H]=s.useState(!1),[G,S]=s.useState([]),E=ne.useMemo(()=>wa(d),[d]),D=Ue(d),{videoHistory:T}=ht(),[P,g]=s.useState(0),{isGenerating:V}=gt("video"),{language:$}=he(),{createTask:K}=ye();s.useEffect(()=>{const M=F=>{const B=F.videoModelName||"veo3";B!==d&&j(B)};return J.addListener(M),()=>J.removeListener(M)},[d]),s.useEffect(()=>{v&&v!==d&&j(v)},[v]);const[i,l]=s.useState(!1),[k,R]=s.useState(!1);s.useEffect(()=>{if(k){R(!1);return}const M=f.imageUpload.maxCount,F=f.imageUpload.labels||[];if(z(w.duration),b(w.size),p.length>0){const B=p.slice(0,M).map((W,Y)=>({...W,slot:Y,slotLabel:F[Y]||`参考图${Y+1}`}));N(B)}else N([]);Ue(d)||(H(!1),S([]))},[d,w,k,p,f.imageUpload]);const O=ne.useRef("");s.useEffect(()=>{if(i)return;const M=JSON.stringify({prompt:a,image:t==null?void 0:t.url,images:n==null?void 0:n.map(Z=>Z.url),duration:o,model:r,size:c,result:m});if(O.current===M)return;O.current=M,C(a);const F=f.imageUpload.maxCount,B=f.imageUpload.labels||[];let W=[];n&&n.length>0?W=n:t&&(W=[{slot:0,slotLabel:"参考图",url:t.url||"",name:t.name,file:t.file}]),h(W);const Y=W.slice(0,F).map((Z,ie)=>({...Z,slot:ie,slotLabel:B[ie]||`参考图${ie+1}`}));N(Y),o!==void 0&&z(o.toString()),c&&b(c),_(null)},[a,t,n,o,c,m,f.imageUpload,i]),s.useEffect(()=>(_(null),()=>{_(null)}),[]);const q=()=>{C(""),h([]),N([]),_(null);const M=Se(d);z(M.duration),b(M.size),l(!1),H(!1),S([]),window.dispatchEvent(new CustomEvent("ai-video-clear"))},ae=ne.useCallback((M,F)=>M.map((B,W)=>({slot:W,slotLabel:F[W]||`参考图${W+1}`,url:B.url,name:B.name,file:B.file})),[]),le=ne.useCallback(M=>M.map(F=>({url:F.url,name:F.name,file:F.file})),[]),re=ne.useCallback(M=>{const F=f.imageUpload.labels||[],B=ae(M,F);N(B),h(B)},[f.imageUpload.labels,ae]),se=ne.useMemo(()=>_t("video",$,T),[T,$,P]),oe=M=>{jt("video",M),g(F=>F+1)},ue=M=>{var F,B;if(l(!0),R(!0),M.params.model){j(M.params.model);const W=J.get();J.update({...W,videoModelName:M.params.model})}if((F=M.params.storyboard)!=null&&F.enabled&&((B=M.params.storyboard)!=null&&B.scenes))H(!0),S(M.params.storyboard.scenes),C("");else{const W=M.params.prompt||"",Y=La(W);Y&&Y.length>0?(H(!0),S(Y),C("")):(H(!1),S([]),C(W))}if(M.params.seconds!==void 0){const W=typeof M.params.seconds=="string"?M.params.seconds:M.params.seconds.toString();z(W)}if(M.params.size&&b(M.params.size),M.params.uploadedImages&&M.params.uploadedImages.length>0){h(M.params.uploadedImages);const W=M.params.model||d,Y=De(W),Z=Y.imageUpload.maxCount,ie=Y.imageUpload.labels||[],me=M.params.uploadedImages.slice(0,Z).map((je,ce)=>({...je,slot:ce,slotLabel:ie[ce]||`参考图${ce+1}`}));N(me)}else h([]),N([]);_(null)},fe=async(M=1)=>{if(A){const F=Aa(G,parseFloat(I),E.minSceneDuration);if(!F.valid){_(F.error||"场景配置无效");return}}else if(!u.trim()){_($==="zh"?"请输入视频描述":"Please enter video description");return}try{const F=[];for(const Z of L)if(Z.file){const ie=await new Promise((me,je)=>{const ce=new FileReader;ce.onload=()=>me(ce.result),ce.onerror=je,ce.readAsDataURL(Z.file)});F.push({...Z,url:ie,file:void 0})}else F.push({...Z,file:void 0});const B=A?za(G):u.trim(),W=[],Y=M>1?`video_batch_${Date.now()}`:void 0;for(let Z=0;Z<M;Z++){const ie={prompt:B,model:d,seconds:I,size:y,uploadedImages:F,...A&&{storyboard:{enabled:!0,scenes:G,totalDuration:parseFloat(I)}},...Y&&{batchId:Y,batchIndex:Z+1,batchTotal:M},autoInsertToCanvas:!0},me=K(ie,X.VIDEO);me&&W.push(me.id)}W.length>0?(Q.success($==="zh"?M>1?`${W.length} 个视频任务已添加到队列,将在后台生成`:"视频任务已添加到队列,将在后台生成":M>1?`${W.length} video tasks added to queue, will be generated in background`:"Video task added to queue, will be generated in background"),oe(B),C(""),h([]),N([]),H(!1),S([]),_(null),l(!1)):_($==="zh"?"任务创建失败,请检查参数或稍后重试":"Failed to create task, please check parameters or try again later")}catch(F){console.error("Failed to create task:",F);let B=$==="zh"?"任务创建失败,请检查参数或稍后重试":"Failed to create task, please check parameters or try again later";F.message&&(F.message.includes("exceed 5000 characters")?B=$==="zh"?"提示词不能超过 5000 字符":"Prompt must not exceed 5000 characters":F.message.includes("Duplicate submission")?B=$==="zh"?"请勿重复提交,请等待 5 秒后再试":"Duplicate submission. Please wait 5 seconds.":F.message.includes("Invalid parameters")&&(B=$==="zh"?`参数错误: ${F.message.replace("Invalid parameters: ","")}`:F.message)),_(B)}};return ft(V,u,fe),e.jsx("div",{className:"ai-video-generation-container",children:e.jsxs("div",{className:"main-content",children:[e.jsxs("div",{className:"ai-image-generation-section",children:[e.jsxs("div",{className:"ai-image-generation-form",children:[v!==void 0&&x&&e.jsx("div",{className:"model-selector-wrapper",children:e.jsx(_e,{value:v,onChange:M=>x(M),options:ba,size:"small",placeholder:$==="zh"?"选择视频模型":"Select Video Model",filterable:!0,creatable:!0,disabled:V})}),e.jsx(ka,{model:d,duration:I,size:y,onDurationChange:z,onSizeChange:b,disabled:V}),e.jsx(St,{images:le(L),onImagesChange:re,language:$,disabled:V,multiple:f.imageUpload.maxCount>1,maxCount:f.imageUpload.maxCount,slotLabels:f.imageUpload.mode==="frames"?f.imageUpload.labels:void 0,label:f.imageUpload.mode==="frames"?$==="zh"?"首尾帧图片 (可选)":"Start/End Frames (Optional)":$==="zh"?"参考图片 (可选)":"Reference Images (Optional)"}),D&&e.jsx($a,{enabled:A,onEnabledChange:H,totalDuration:parseFloat(I),maxScenes:E.maxScenes,minSceneDuration:E.minSceneDuration,scenes:G,onScenesChange:S,disabled:V}),!A&&e.jsx(yt,{prompt:u,onPromptChange:C,presetPrompts:se,language:$,type:"video",disabled:V,onError:_,videoProvider:f.provider}),e.jsx(xt,{error:U})]}),e.jsx(vt,{language:$,type:"video",isGenerating:V,hasGenerated:!1,canGenerate:A?G.length>0:!!u.trim(),onGenerate:fe,onReset:q})]}),e.jsx("div",{className:"task-sidebar",children:e.jsx(Dt,{taskType:X.VIDEO,onEditTask:ue})})]})})};let te=null,ve=null;const Ga=async()=>te||(typeof window<"u"&&window.WinBox?(te=window.WinBox,te):ve||(ve=(async()=>{try{if(await be(()=>import("./winbox.bundle.min-CoRPjCs5.js"),[],import.meta.url),te=window.WinBox,te)return te;throw new Error("WinBox not found after import")}catch(a){return console.warn("Dynamic import failed, falling back to CDN:",a),new Promise((t,n)=>{const o=document.createElement("script");o.src="https://cdn.jsdelivr.net/npm/winbox@0.2.82/dist/winbox.bundle.min.js",o.async=!0,o.onload=()=>{te=window.WinBox,te?t(te):n(new Error("WinBox not found after CDN loading"))},o.onerror=n,document.head.appendChild(o)})}})(),ve)),tt=({visible:a,title:t,onClose:n,children:o,width:r="80%",height:c="80%",minWidth:m=400,minHeight:v=300,x="center",y:u="center",maximizable:C=!0,minimizable:U=!0,resizable:_=!0,movable:d=!0,modal:j=!1,background:f="linear-gradient(135deg, #5A4FCF 0%, #7B68EE 50%, #E91E63 100%)",border:w=0,className:I,id:z,headerContent:y,container:b,onMaximize:p,onRestore:h,onFocus:L,onBlur:N,onMove:A,onResize:H,autoMaximize:G=!1})=>{const S=s.useRef(null),E=s.useRef(null),D=s.useRef(null),[T,P]=s.useState(null),[g,V]=s.useState(!1),[$,K]=s.useState(!!te),i=ya(D,{enablePositionTracking:!1,enableScaleCompensation:!0});s.useEffect(()=>{$||Ga().then(()=>K(!0))},[$]);const l=s.useCallback(()=>(n==null||n(),!1),[n]);return s.useEffect(()=>{if(!(!$||!te)){if(!a){if(S.current){try{S.current.close(!0)}catch{}S.current=null,D.current=null,P(null),V(!1)}return}if(a&&!S.current&&E.current){const k=["winbox-react"];C||k.push("no-max"),U||k.push("no-min"),_||k.push("no-resize"),d||k.push("no-move"),k.push("no-full"),I&&k.push(I);const R=new te({id:z,title:t,mount:E.current,width:r,height:c,minwidth:m,minheight:v,x,y:u,modal:j,background:f,border:w,class:k,root:b||document.body,onclose:l,onmaximize:p,onrestore:h,onfocus:L,onblur:N,onmove:A,onresize:H});if(S.current=R,R.window&&(D.current=R.window,requestAnimationFrame(()=>{i()})),y&&R.window){const O=R.window.querySelector(".wb-drag");if(O){const q=document.createElement("div");q.className="wb-header-custom",O.appendChild(q),P(q)}}V(!0),G&&setTimeout(()=>{S.current&&S.current.maximize()},100)}}},[a,$,G]),s.useEffect(()=>()=>{if(S.current){try{S.current.onclose=null,S.current.close(!0)}catch{}S.current=null,D.current=null}},[]),s.useEffect(()=>{S.current&&t&&S.current.setTitle(t)},[t]),s.useEffect(()=>{S.current&&(a?(S.current.show(),S.current.focus()):S.current.hide())},[a]),s.useEffect(()=>{S.current&&G&&S.current.maximize()},[G]),e.jsxs(e.Fragment,{children:[e.jsx("div",{style:{display:"none"},"data-winbox-placeholder":"true",children:e.jsx("div",{ref:E,className:"winbox-content-wrapper",style:{display:a?"block":"none"},children:o})}),g&&y&&T&<.createPortal(y,T)]})},Wa=s.lazy(()=>be(()=>import("./batch-image-generation-Baqb01Lm.js"),__vite__mapDeps([7,1,2,8,9,10,11,12,13]),import.meta.url)),Ha=({container:a})=>{var A,H,G,S;const{appState:t,setAppState:n}=we(),{language:o}=he(),r=Te(),c=s.useRef(!1),m=s.useRef(null),[v,x]=s.useState(""),[u,C]=s.useState("");s.useEffect(()=>{const E=J.get();x(E.imageModelName||"gemini-3-pro-image-preview-vip"),C(E.videoModelName||"veo3")},[]),s.useEffect(()=>{const E=D=>{D.imageModelName&&x(D.imageModelName),D.videoModelName&&C(D.videoModelName)};return J.addListener(E),()=>J.removeListener(E)},[]);const U=E=>{x(E);const D=J.get();J.update({...D,imageModelName:E})},_=E=>{C(E);const D=J.get();J.update({...D,videoModelName:E})},[d,j]=s.useState({initialPrompt:"",initialImages:[],selectedElementIds:[]}),[f,w]=s.useState({initialPrompt:"",initialImage:void 0}),[I,z]=s.useState(!1),[y,b]=s.useState(()=>{try{return localStorage.getItem(Ie)==="batch"?"batch":"single"}catch{return"single"}}),p=s.useCallback(E=>{b(E),z(E==="batch");try{localStorage.setItem(Ie,E)}catch(D){console.warn("Failed to save image mode:",D)}},[]);s.useEffect(()=>{if(t.openDialogType===ee.aiImageGeneration){if(d.initialImages&&d.initialImages.length>0||d.initialPrompt&&d.initialPrompt.trim()!==""){z(!1);return}try{const D=localStorage.getItem(Ie);z(D==="batch")}catch{z(!1)}}},[t.openDialogType,d.initialImages,d.initialPrompt]);const h=s.useRef(null);s.useEffect(()=>{if(!r||!t.openDialogType){h.current=t.openDialogType;return}h.current!==t.openDialogType&&(c.current||(h.current=t.openDialogType,t.openDialogType===ee.aiImageGeneration&&(async()=>{c.current=!0,m.current&&clearTimeout(m.current),m.current=setTimeout(()=>{console.warn("Processing timeout, resetting processing state"),c.current=!1},1e4);try{if(t.dialogInitialData){j({initialPrompt:t.dialogInitialData.initialPrompt||t.dialogInitialData.prompt||"",initialImages:t.dialogInitialData.initialImages||t.dialogInitialData.uploadedImages||[],selectedElementIds:[],initialResultUrl:t.dialogInitialData.initialResultUrl||t.dialogInitialData.resultUrl});return}const D=t.lastSelectedElementIds||[],T=await He(r,D),P=[];T.remainingImages.forEach(g=>{P.push({url:g.url,name:g.name||`selected-image-${Date.now()}.png`})}),T.graphicsImage&&P.push({url:T.graphicsImage,name:`graphics-combined-${Date.now()}.png`}),j({initialPrompt:T.remainingText||"",initialImages:P,selectedElementIds:D})}catch(D){console.warn("Error processing selected content for AI:",D);const T=qe(r),P=T.images.map(g=>({url:g.url,name:g.name||`selected-image-${Date.now()}.png`}));j({initialPrompt:T.text||"",initialImages:P,selectedElementIds:[]})}finally{c.current=!1,m.current&&(clearTimeout(m.current),m.current=null)}})(),t.openDialogType===ee.aiVideoGeneration&&(async()=>{c.current=!0,m.current&&clearTimeout(m.current),m.current=setTimeout(()=>{console.warn("Video processing timeout, resetting processing state"),c.current=!1},1e4);try{if(t.dialogInitialData){const g={initialPrompt:t.dialogInitialData.initialPrompt||t.dialogInitialData.prompt||"",initialImage:t.dialogInitialData.initialImage||t.dialogInitialData.uploadedImage,initialImages:t.dialogInitialData.initialImages||t.dialogInitialData.uploadedImages,initialDuration:t.dialogInitialData.initialDuration||t.dialogInitialData.duration,initialModel:t.dialogInitialData.initialModel||t.dialogInitialData.model,initialSize:t.dialogInitialData.initialSize||t.dialogInitialData.size,initialResultUrl:t.dialogInitialData.initialResultUrl||t.dialogInitialData.resultUrl};w(g);return}const D=t.lastSelectedElementIds||[],T=await He(r,D),P=[];T.remainingImages.length>0?T.remainingImages.forEach((g,V)=>{P.push({url:g.url,name:g.name||`selected-image-${V+1}-${Date.now()}.png`})}):T.graphicsImage&&P.push({url:T.graphicsImage,name:`graphics-combined-${Date.now()}.png`}),w({initialPrompt:T.remainingText||"",initialImage:P.length>0?P[0]:void 0,initialImages:P.map((g,V)=>({slot:V,slotLabel:`参考图${V+1}`,url:g.url,name:g.name}))})}catch(D){console.warn("Error processing selected content for AI video:",D);const T=qe(r),P=T.images.map((g,V)=>({url:g.url,name:g.name||`selected-image-${V+1}-${Date.now()}.png`}));w({initialPrompt:T.text||"",initialImage:P.length>0?P[0]:void 0,initialImages:P.map((g,V)=>({slot:V,slotLabel:`参考图${V+1}`,url:g.url,name:g.name}))})}finally{c.current=!1,m.current&&(clearTimeout(m.current),m.current=null)}})()))},[t.openDialogType]),s.useEffect(()=>{t.openDialogType||(c.current=!1,h.current=null)},[t.openDialogType]);const L=s.useCallback(()=>{const E=localStorage.getItem(Ve);if(E)try{const D=JSON.parse(E);D.timestamp=Date.now(),localStorage.setItem(Ve,JSON.stringify(D))}catch(D){console.warn("Failed to update cache timestamp:",D)}n(D=>({...D,openDialogType:null}))},[n]),N=s.useCallback(()=>{const E=localStorage.getItem(Be);if(E)try{const D=JSON.parse(E);D.timestamp=Date.now(),localStorage.setItem(Be,JSON.stringify(D))}catch(D){console.warn("Failed to update cache timestamp:",D)}n(D=>({...D,openDialogType:null}))},[n]);return e.jsxs(e.Fragment,{children:[e.jsx(Ge,{open:t.openDialogType===ee.mermaidToDrawnix,onOpenChange:E=>{n({...t,openDialogType:E?ee.mermaidToDrawnix:null})},children:e.jsx(We,{className:"Dialog ttd-dialog",container:a,children:e.jsx(Ca,{})})}),e.jsx(Ge,{open:t.openDialogType===ee.markdownToDrawnix,onOpenChange:E=>{n({...t,openDialogType:E?ee.markdownToDrawnix:null})},children:e.jsx(We,{className:"Dialog ttd-dialog",container:a,children:e.jsx(Sa,{})})}),e.jsx(tt,{visible:t.openDialogType===ee.aiImageGeneration,title:y==="batch"?o==="zh"?"批量出图":"Batch Generation":o==="zh"?"AI 图片生成":"AI Image Generation",headerContent:e.jsxs("div",{className:"image-generation-mode-tabs",children:[e.jsx("button",{className:`mode-tab ${y==="single"?"active":""}`,onClick:()=>p("single"),children:o==="zh"?"AI 图片生成":"AI Image"}),e.jsx("button",{className:`mode-tab ${y==="batch"?"active":""}`,onClick:()=>p("batch"),children:o==="zh"?"批量出图":"Batch"})]}),onClose:L,width:"80%",height:"60%",minWidth:1024,minHeight:500,x:"center",y:"center",modal:!1,minimizable:!1,className:"winbox-ai-generation winbox-ai-image-generation",container:a,autoMaximize:I,children:t.openDialogType===ee.aiImageGeneration&&(y==="batch"?e.jsx(s.Suspense,{fallback:e.jsx("div",{className:"loading-fallback",children:o==="zh"?"加载中...":"Loading..."}),children:e.jsx(Wa,{onSwitchToSingle:()=>p("single")})}):e.jsx(Va,{initialPrompt:d.initialPrompt,initialImages:d.initialImages,selectedElementIds:d.selectedElementIds,initialWidth:((A=t.dialogInitialData)==null?void 0:A.initialWidth)||((H=t.dialogInitialData)==null?void 0:H.width),initialHeight:((G=t.dialogInitialData)==null?void 0:G.initialHeight)||((S=t.dialogInitialData)==null?void 0:S.height),initialResultUrl:d.initialResultUrl,selectedModel:v,onModelChange:U}))}),e.jsx(tt,{visible:t.openDialogType===ee.aiVideoGeneration,title:o==="zh"?"AI 视频生成":"AI Video Generation",onClose:N,width:"70%",height:"60%",minWidth:800,minHeight:600,x:"center",y:"center",modal:!1,minimizable:!1,className:"winbox-ai-generation winbox-ai-video-generation",container:a,children:t.openDialogType===ee.aiVideoGeneration&&e.jsx(Ba,{initialPrompt:f.initialPrompt,initialImage:f.initialImage,initialImages:f.initialImages,initialDuration:f.initialDuration,initialModel:f.initialModel,initialSize:f.initialSize,initialResultUrl:f.initialResultUrl,selectedModel:u,onModelChange:_})})]})},Xa=s.memo(Ha,(a,t)=>a.container===t.container);export{Xa as TTDDialog};
|