wizards 0.2.60 → 0.2.61

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.
Files changed (40) hide show
  1. package/apps/runtime/dist/app.js +8 -3
  2. package/apps/runtime/dist/cli/home.js +14 -5
  3. package/apps/web/dist/assets/AboutDialog-OEVFZuMQ.js +1 -0
  4. package/apps/web/dist/assets/{ChangelogDialog-D8BjIzmG.js → ChangelogDialog-6xNrjOIm.js} +1 -1
  5. package/apps/web/dist/assets/{ChatView-NuMTv2_v.js → ChatView-3ESCXBad.js} +2 -2
  6. package/apps/web/dist/assets/{EditorPage-BLFioERj.js → EditorPage-DEWSbQzj.js} +3 -3
  7. package/apps/web/dist/assets/{FlowPreview-DbwvacRX.js → FlowPreview-COK6Z3jV.js} +1 -1
  8. package/apps/web/dist/assets/{Harness-B-6EbJ89.js → Harness-DrnkZ8kf.js} +1 -1
  9. package/apps/web/dist/assets/{Marketplace-C3xWcJYM.js → Marketplace-CmeAQDOY.js} +2 -2
  10. package/apps/web/dist/assets/{NewWizardPage-wt1p9J46.js → NewWizardPage-BBaIaspG.js} +1 -1
  11. package/apps/web/dist/assets/ProjectPage-7WwZ4ier.js +2 -0
  12. package/apps/web/dist/assets/{PublicRunner-CkoPSvsY.js → PublicRunner-DL3Zdyyp.js} +1 -1
  13. package/apps/web/dist/assets/{ReadOnly-zQecD9OB.js → ReadOnly-B--cynCf.js} +1 -1
  14. package/apps/web/dist/assets/RunDrawer-DhKe5qPM.js +4 -0
  15. package/apps/web/dist/assets/{RunnerView-B1GivAFs.js → RunnerView-Dzz0vC_M.js} +1 -1
  16. package/apps/web/dist/assets/SettingsPage-CaTwyuf_.js +1 -0
  17. package/apps/web/dist/assets/SetupPage-BqW4ZghT.js +1 -0
  18. package/apps/web/dist/assets/{SharePage-CtXGMzrQ.js → SharePage-CYtDkLLD.js} +1 -1
  19. package/apps/web/dist/assets/{brand-DIKyySmf.js → brand-ClxXyg-d.js} +1 -1
  20. package/apps/web/dist/assets/changelog-CUTIPZpA.js +1 -0
  21. package/apps/web/dist/assets/{circle-alert-B9b9Vb9k.js → circle-alert-CyjKeZm5.js} +1 -1
  22. package/apps/web/dist/assets/{esm-BW4CnGD3.js → esm-C0TPPvNu.js} +1 -1
  23. package/apps/web/dist/assets/{index-DVnigS8k.css → index-BBpolc_L.css} +1 -1
  24. package/apps/web/dist/assets/index-CsKV2ZNO.js +11 -0
  25. package/apps/web/dist/assets/{lock-BNvsUKTg.js → lock-D5tH2Lqc.js} +1 -1
  26. package/apps/web/dist/assets/{session-CSbo-pmx.js → session-DEXxyxEc.js} +1 -1
  27. package/apps/web/dist/assets/{settings-menu-CFwH7wPe.js → settings-menu-vtL00p0G.js} +1 -1
  28. package/apps/web/dist/assets/{ui-FW7ypPI6.js → ui-SKtUMhUq.js} +1 -1
  29. package/apps/web/dist/assets/{upload-MQ_24gSb.js → upload-hT54Sh8P.js} +1 -1
  30. package/apps/web/dist/assets/{volume-2-B1mj20eS.js → volume-2-BX_wS3Lh.js} +1 -1
  31. package/apps/web/dist/index.html +7 -7
  32. package/apps/web/dist/mcp/flow.html +2 -2
  33. package/package.json +1 -1
  34. package/apps/web/dist/assets/AboutDialog-DovVDLnd.js +0 -1
  35. package/apps/web/dist/assets/ProjectPage-CYFOoHOp.js +0 -2
  36. package/apps/web/dist/assets/RunDrawer-Bx27qRq3.js +0 -4
  37. package/apps/web/dist/assets/SettingsPage-Bo0liCas.js +0 -1
  38. package/apps/web/dist/assets/SetupPage-DyoGmTbA.js +0 -1
  39. package/apps/web/dist/assets/changelog-sHZ4ve7D.js +0 -1
  40. package/apps/web/dist/assets/index-cEhTXa2U.js +0 -11
@@ -1 +1 @@
1
- import{r as e}from"./rolldown-runtime-hePW80VL.js";import{n as t,t as n}from"./jsx-runtime-BNakU3Ej.js";import{yt as r}from"./ui-FW7ypPI6.js";import{a as i,c as a,i as o,n as s,r as c,s as l,t as u}from"./esm-BW4CnGD3.js";var d=e(t(),1),f=e(n(),1),p=208,m=42,h=26,g=22,_=132;function v({data:e}){let t=e.icon;return(0,f.jsxs)(`div`,{style:{width:p,height:m},className:r(`flex cursor-default items-center gap-2.5 rounded-xl px-2.5`,e.optional?`border border-ink-4 border-dashed`:`bg-paper-2 ring-1 ring-border-soft`),children:[(0,f.jsx)(c,{type:`target`,position:a.Top}),(0,f.jsx)(c,{type:`target`,id:`in`,position:a.Right}),(0,f.jsx)(`span`,{className:r(`inline-flex size-6 shrink-0 items-center justify-center rounded-md`,e.tone),children:(0,f.jsx)(t,{className:`size-3.5`})}),(0,f.jsx)(`span`,{className:`truncate font-medium text-[0.8125rem] text-ink`,children:e.title}),(0,f.jsx)(c,{type:`source`,position:a.Bottom}),(0,f.jsx)(c,{type:`source`,id:`out`,position:a.Right})]})}function y({sourceX:e,sourceY:t,targetX:n,targetY:r,label:i,markerEnd:a}){let o=Math.max(e,n)+g,c=[`M ${e} ${t}`,`H ${o-8}`,`Q ${o} ${t} ${o} ${t+8}`,`V ${r-8}`,`Q ${o} ${r} ${o-8} ${r}`,`H ${n}`].join(` `);return(0,f.jsxs)(f.Fragment,{children:[(0,f.jsx)(u,{path:c,markerEnd:a,style:{strokeDasharray:`5 4`}}),(0,f.jsx)(s,{children:(0,f.jsx)(`div`,{style:{width:_,transform:`translate(${o+8}px, ${(t+r)/2}px) translateY(-50%)`},className:`absolute text-[0.6875rem] text-ink-2 leading-snug`,children:i})})]})}var b={step:v},x={branch:y};function S(e){let t={markerEnd:{type:l.ArrowClosed,width:14,height:14,color:`var(--ink-4)`}},n=e.map((e,t)=>({id:e.id,type:`step`,position:{x:0,y:t*68},data:{title:e.title,icon:e.icon,tone:e.tone,optional:e.optional},draggable:!1})),r=[],i=!1;return e.forEach((n,a)=>{let o=e[a+1];for(let[a,o]of(n.branches??[]).entries())e.some(e=>e.id===o.to)&&(i=!0,r.push({id:`b-${n.id}-${a}`,type:`branch`,source:n.id,sourceHandle:`out`,target:o.to,targetHandle:`in`,label:o.when,...t}));o&&r.push({id:`n-${n.id}`,type:`straight`,source:n.id,target:o.id,...t})}),{nodes:n,edges:r,width:p+(i?162:0),height:e.length*68-h}}function C({steps:e}){let{nodes:t,edges:n,width:r,height:a}=(0,d.useMemo)(()=>S(e),[e]);return e.length?(0,f.jsx)(`div`,{className:`max-w-full`,style:{width:r,height:a+4},children:(0,f.jsx)(o,{children:(0,f.jsx)(i,{nodes:t,edges:n,nodeTypes:b,edgeTypes:x,defaultViewport:{x:1,y:2,zoom:1},minZoom:1,maxZoom:1,nodesConnectable:!1,nodesDraggable:!1,nodesFocusable:!1,edgesFocusable:!1,elementsSelectable:!1,panOnDrag:!1,panOnScroll:!1,zoomOnScroll:!1,zoomOnPinch:!1,zoomOnDoubleClick:!1,preventScrolling:!1,proOptions:{hideAttribution:!0}})})}):null}export{C as default};
1
+ import{r as e}from"./rolldown-runtime-hePW80VL.js";import{n as t,t as n}from"./jsx-runtime-BNakU3Ej.js";import{yt as r}from"./ui-SKtUMhUq.js";import{a as i,c as a,i as o,n as s,r as c,s as l,t as u}from"./esm-C0TPPvNu.js";var d=e(t(),1),f=e(n(),1),p=208,m=42,h=26,g=22,_=132;function v({data:e}){let t=e.icon;return(0,f.jsxs)(`div`,{style:{width:p,height:m},className:r(`flex cursor-default items-center gap-2.5 rounded-xl px-2.5`,e.optional?`border border-ink-4 border-dashed`:`bg-paper-2 ring-1 ring-border-soft`),children:[(0,f.jsx)(c,{type:`target`,position:a.Top}),(0,f.jsx)(c,{type:`target`,id:`in`,position:a.Right}),(0,f.jsx)(`span`,{className:r(`inline-flex size-6 shrink-0 items-center justify-center rounded-md`,e.tone),children:(0,f.jsx)(t,{className:`size-3.5`})}),(0,f.jsx)(`span`,{className:`truncate font-medium text-[0.8125rem] text-ink`,children:e.title}),(0,f.jsx)(c,{type:`source`,position:a.Bottom}),(0,f.jsx)(c,{type:`source`,id:`out`,position:a.Right})]})}function y({sourceX:e,sourceY:t,targetX:n,targetY:r,label:i,markerEnd:a}){let o=Math.max(e,n)+g,c=[`M ${e} ${t}`,`H ${o-8}`,`Q ${o} ${t} ${o} ${t+8}`,`V ${r-8}`,`Q ${o} ${r} ${o-8} ${r}`,`H ${n}`].join(` `);return(0,f.jsxs)(f.Fragment,{children:[(0,f.jsx)(u,{path:c,markerEnd:a,style:{strokeDasharray:`5 4`}}),(0,f.jsx)(s,{children:(0,f.jsx)(`div`,{style:{width:_,transform:`translate(${o+8}px, ${(t+r)/2}px) translateY(-50%)`},className:`absolute text-[0.6875rem] text-ink-2 leading-snug`,children:i})})]})}var b={step:v},x={branch:y};function S(e){let t={markerEnd:{type:l.ArrowClosed,width:14,height:14,color:`var(--ink-4)`}},n=e.map((e,t)=>({id:e.id,type:`step`,position:{x:0,y:t*68},data:{title:e.title,icon:e.icon,tone:e.tone,optional:e.optional},draggable:!1})),r=[],i=!1;return e.forEach((n,a)=>{let o=e[a+1];for(let[a,o]of(n.branches??[]).entries())e.some(e=>e.id===o.to)&&(i=!0,r.push({id:`b-${n.id}-${a}`,type:`branch`,source:n.id,sourceHandle:`out`,target:o.to,targetHandle:`in`,label:o.when,...t}));o&&r.push({id:`n-${n.id}`,type:`straight`,source:n.id,target:o.id,...t})}),{nodes:n,edges:r,width:p+(i?162:0),height:e.length*68-h}}function C({steps:e}){let{nodes:t,edges:n,width:r,height:a}=(0,d.useMemo)(()=>S(e),[e]);return e.length?(0,f.jsx)(`div`,{className:`max-w-full`,style:{width:r,height:a+4},children:(0,f.jsx)(o,{children:(0,f.jsx)(i,{nodes:t,edges:n,nodeTypes:b,edgeTypes:x,defaultViewport:{x:1,y:2,zoom:1},minZoom:1,maxZoom:1,nodesConnectable:!1,nodesDraggable:!1,nodesFocusable:!1,edgesFocusable:!1,elementsSelectable:!1,panOnDrag:!1,panOnScroll:!1,zoomOnScroll:!1,zoomOnPinch:!1,zoomOnDoubleClick:!1,preventScrolling:!1,proOptions:{hideAttribution:!0}})})}):null}export{C as default};
@@ -1,4 +1,4 @@
1
- import{r as e}from"./rolldown-runtime-hePW80VL.js";import{n as t,t as n}from"./jsx-runtime-BNakU3Ej.js";import{O as r}from"./logo-C4V2_3Ar.js";import{t as i}from"./useMutation-DKyQXgyj.js";import{Ct as a,Mt as o,Qt as s,a as c,f as l,rt as u,yt as d}from"./ui-FW7ypPI6.js";import{V as f}from"./index-cEhTXa2U.js";var p=e(t(),1),m=2,h=1,g=class{activate(e){this._terminal=e}dispose(){}fit(){let e=this.proposeDimensions();if(!e||!this._terminal||isNaN(e.cols)||isNaN(e.rows))return;let t=this._terminal._core;(this._terminal.rows!==e.rows||this._terminal.cols!==e.cols)&&(t._renderService.clear(),this._terminal.resize(e.cols,e.rows))}proposeDimensions(){if(!this._terminal||!this._terminal.element||!this._terminal.element.parentElement)return;let e=this._terminal._core._renderService.dimensions;if(e.css.cell.width===0||e.css.cell.height===0)return;let t=this._terminal.options.scrollback===0?0:this._terminal.options.overviewRuler?.width||14,n=window.getComputedStyle(this._terminal.element.parentElement),r=parseInt(n.getPropertyValue(`height`)),i=Math.max(0,parseInt(n.getPropertyValue(`width`))),a=window.getComputedStyle(this._terminal.element),o={top:parseInt(a.getPropertyValue(`padding-top`)),bottom:parseInt(a.getPropertyValue(`padding-bottom`)),right:parseInt(a.getPropertyValue(`padding-right`)),left:parseInt(a.getPropertyValue(`padding-left`))},s=o.top+o.bottom,c=o.right+o.left,l=r-s,u=i-c-t;return{cols:Math.max(m,Math.floor(u/e.css.cell.width)),rows:Math.max(h,Math.floor(l/e.css.cell.height))}}},_=class{constructor(e,t,n,r={}){this._terminal=e,this._regex=t,this._handler=n,this._options=r}provideLinks(e,t){let n=te.computeLink(e,this._regex,this._terminal,this._handler);t(this._addCallbacks(n))}_addCallbacks(e){return e.map(e=>(e.leave=this._options.leave,e.hover=(t,n)=>{if(this._options.hover){let{range:r}=e;this._options.hover(t,n,r)}},e))}};function ee(e){try{let t=new URL(e),n=t.password&&t.username?`${t.protocol}//${t.username}:${t.password}@${t.host}`:t.username?`${t.protocol}//${t.username}@${t.host}`:`${t.protocol}//${t.host}`;return e.toLocaleLowerCase().startsWith(n.toLocaleLowerCase())}catch{return!1}}var te=class e{static computeLink(t,n,r,i){let a=new RegExp(n.source,(n.flags||``)+`g`),[o,s]=e._getWindowedLineStrings(t-1,r),c=o.join(``),l,u=[];for(;l=a.exec(c);){let t=l[0];if(!ee(t))continue;let[n,a]=e._mapStrIdx(r,s,0,l.index),[o,c]=e._mapStrIdx(r,n,a,t.length);if(n===-1||a===-1||o===-1||c===-1)continue;let d={start:{x:a+1,y:n+1},end:{x:c,y:o+1}};u.push({range:d,text:t,activate:i})}return u}static _getWindowedLineStrings(e,t){let n,r=e,i=e,a=0,o=``,s=[];if(n=t.buffer.active.getLine(e)){let e=n.translateToString(!0);if(n.isWrapped&&e[0]!==` `){for(a=0;(n=t.buffer.active.getLine(--r))&&a<2048&&(o=n.translateToString(!0),a+=o.length,s.push(o),n.isWrapped&&o.indexOf(` `)===-1););s.reverse()}for(s.push(e),a=0;(n=t.buffer.active.getLine(++i))&&n.isWrapped&&a<2048&&(o=n.translateToString(!0),a+=o.length,s.push(o),o.indexOf(` `)===-1););}return[s,r]}static _mapStrIdx(e,t,n,r){let i=e.buffer.active,a=i.getNullCell(),o=n;for(;r;){let e=i.getLine(t);if(!e)return[-1,-1];for(let n=o;n<e.length;++n){e.getCell(n,a);let o=a.getChars();if(a.getWidth()&&(r-=o.length||1,n===e.length-1&&o===``)){let e=i.getLine(t+1);e&&e.isWrapped&&(e.getCell(0,a),a.getWidth()===2&&(r+=1))}if(r<0)return[t,n]}t++,o=0}return[t,o]}},ne=/(https?|HTTPS?):[/]{2}[^\s"'!*(){}|\\\^<>`]*[^\s"':,.!?{}|\\\^~\[\]`()<>]/;function re(e,t){let n=window.open();if(n){try{n.opener=null}catch{}n.location.href=t}else console.warn(`Opening link blocked as opener could not be cleared`)}var ie=class{constructor(e=re,t={}){this._handler=e,this._options=t}activate(e){this._terminal=e;let t=this._options,n=t.urlRegex||ne;this._linkProvider=this._terminal.registerLinkProvider(new _(this._terminal,n,this._handler,t))}dispose(){this._linkProvider?.dispose()}},ae=Object.defineProperty,oe=Object.getOwnPropertyDescriptor,se=(e,t)=>{for(var n in t)ae(e,n,{get:t[n],enumerable:!0})},v=(e,t,n,r)=>{for(var i=r>1?void 0:r?oe(t,n):t,a=e.length-1,o;a>=0;a--)(o=e[a])&&(i=(r?o(t,n,i):o(i))||i);return r&&i&&ae(t,n,i),i},y=(e,t)=>(n,r)=>t(n,r,e),ce=`Terminal input`,b={get:()=>ce,set:e=>ce=e},le=`Too much output to announce, navigate to rows manually to read`,ue={get:()=>le,set:e=>le=e};function de(e){return e.replace(/\r?\n/g,`\r`)}function x(e,t){return t?`\x1B[200~`+e+`\x1B[201~`:e}function fe(e,t){e.clipboardData&&e.clipboardData.setData(`text/plain`,t.selectionText),e.preventDefault()}function pe(e,t,n,r){e.stopPropagation(),e.clipboardData&&me(e.clipboardData.getData(`text/plain`),t,n,r)}function me(e,t,n,r){e=de(e),e=x(e,n.decPrivateModes.bracketedPasteMode&&r.rawOptions.ignoreBracketedPasteMode!==!0),n.triggerDataEvent(e,!0),t.value=``}function he(e,t,n){let r=n.getBoundingClientRect(),i=e.clientX-r.left-10,a=e.clientY-r.top-10;t.style.width=`20px`,t.style.height=`20px`,t.style.left=`${i}px`,t.style.top=`${a}px`,t.style.zIndex=`1000`,t.focus()}function ge(e,t,n,r,i){he(e,t,n),i&&r.rightClickSelect(e),t.value=r.selectionText,t.select()}function S(e){return e>65535?(e-=65536,String.fromCharCode((e>>10)+55296)+String.fromCharCode(e%1024+56320)):String.fromCharCode(e)}function _e(e,t=0,n=e.length){let r=``;for(let i=t;i<n;++i){let t=e[i];t>65535?(t-=65536,r+=String.fromCharCode((t>>10)+55296)+String.fromCharCode(t%1024+56320)):r+=String.fromCharCode(t)}return r}var ve=class{constructor(){this._interim=0}clear(){this._interim=0}decode(e,t){let n=e.length;if(!n)return 0;let r=0,i=0;if(this._interim){let n=e.charCodeAt(i++);56320<=n&&n<=57343?t[r++]=(this._interim-55296)*1024+n-56320+65536:(t[r++]=this._interim,t[r++]=n),this._interim=0}for(let a=i;a<n;++a){let i=e.charCodeAt(a);if(55296<=i&&i<=56319){if(++a>=n)return this._interim=i,r;let o=e.charCodeAt(a);56320<=o&&o<=57343?t[r++]=(i-55296)*1024+o-56320+65536:(t[r++]=i,t[r++]=o);continue}i!==65279&&(t[r++]=i)}return r}},ye=class{constructor(){this.interim=new Uint8Array(3)}clear(){this.interim.fill(0)}decode(e,t){let n=e.length;if(!n)return 0;let r=0,i,a,o,s,c=0,l=0;if(this.interim[0]){let i=!1,a=this.interim[0];a&=(a&224)==192?31:(a&240)==224?15:7;let o=0,s;for(;(s=this.interim[++o]&63)&&o<4;)a<<=6,a|=s;let c=(this.interim[0]&224)==192?2:(this.interim[0]&240)==224?3:4,u=c-o;for(;l<u;){if(l>=n)return 0;if(s=e[l++],(s&192)!=128){l--,i=!0;break}this.interim[o++]=s,a<<=6,a|=s&63}i||(c===2?a<128?l--:t[r++]=a:c===3?a<2048||a>=55296&&a<=57343||a===65279||(t[r++]=a):a<65536||a>1114111||(t[r++]=a)),this.interim.fill(0)}let u=n-4,d=l;for(;d<n;){for(;d<u&&!((i=e[d])&128)&&!((a=e[d+1])&128)&&!((o=e[d+2])&128)&&!((s=e[d+3])&128);)t[r++]=i,t[r++]=a,t[r++]=o,t[r++]=s,d+=4;if(i=e[d++],i<128)t[r++]=i;else if((i&224)==192){if(d>=n)return this.interim[0]=i,r;if(a=e[d++],(a&192)!=128){d--;continue}if(c=(i&31)<<6|a&63,c<128){d--;continue}t[r++]=c}else if((i&240)==224){if(d>=n)return this.interim[0]=i,r;if(a=e[d++],(a&192)!=128){d--;continue}if(d>=n)return this.interim[0]=i,this.interim[1]=a,r;if(o=e[d++],(o&192)!=128){d--;continue}if(c=(i&15)<<12|(a&63)<<6|o&63,c<2048||c>=55296&&c<=57343||c===65279)continue;t[r++]=c}else if((i&248)==240){if(d>=n)return this.interim[0]=i,r;if(a=e[d++],(a&192)!=128){d--;continue}if(d>=n)return this.interim[0]=i,this.interim[1]=a,r;if(o=e[d++],(o&192)!=128){d--;continue}if(d>=n)return this.interim[0]=i,this.interim[1]=a,this.interim[2]=o,r;if(s=e[d++],(s&192)!=128){d--;continue}if(c=(i&7)<<18|(a&63)<<12|(o&63)<<6|s&63,c<65536||c>1114111)continue;t[r++]=c}}return r}},be=``,xe=` `,Se=class e{constructor(){this.fg=0,this.bg=0,this.extended=new Ce}static toColorRGB(e){return[e>>>16&255,e>>>8&255,e&255]}static fromColorRGB(e){return(e[0]&255)<<16|(e[1]&255)<<8|e[2]&255}clone(){let t=new e;return t.fg=this.fg,t.bg=this.bg,t.extended=this.extended.clone(),t}isInverse(){return this.fg&67108864}isBold(){return this.fg&134217728}isUnderline(){return this.hasExtendedAttrs()&&this.extended.underlineStyle!==0?1:this.fg&268435456}isBlink(){return this.fg&536870912}isInvisible(){return this.fg&1073741824}isItalic(){return this.bg&67108864}isDim(){return this.bg&134217728}isStrikethrough(){return this.fg&2147483648}isProtected(){return this.bg&536870912}isOverline(){return this.bg&1073741824}getFgColorMode(){return this.fg&50331648}getBgColorMode(){return this.bg&50331648}isFgRGB(){return(this.fg&50331648)==50331648}isBgRGB(){return(this.bg&50331648)==50331648}isFgPalette(){return(this.fg&50331648)==16777216||(this.fg&50331648)==33554432}isBgPalette(){return(this.bg&50331648)==16777216||(this.bg&50331648)==33554432}isFgDefault(){return!(this.fg&50331648)}isBgDefault(){return!(this.bg&50331648)}isAttributeDefault(){return this.fg===0&&this.bg===0}getFgColor(){switch(this.fg&50331648){case 16777216:case 33554432:return this.fg&255;case 50331648:return this.fg&16777215;default:return-1}}getBgColor(){switch(this.bg&50331648){case 16777216:case 33554432:return this.bg&255;case 50331648:return this.bg&16777215;default:return-1}}hasExtendedAttrs(){return this.bg&268435456}updateExtended(){this.extended.isEmpty()?this.bg&=-268435457:this.bg|=268435456}getUnderlineColor(){if(this.bg&268435456&&~this.extended.underlineColor)switch(this.extended.underlineColor&50331648){case 16777216:case 33554432:return this.extended.underlineColor&255;case 50331648:return this.extended.underlineColor&16777215;default:return this.getFgColor()}return this.getFgColor()}getUnderlineColorMode(){return this.bg&268435456&&~this.extended.underlineColor?this.extended.underlineColor&50331648:this.getFgColorMode()}isUnderlineColorRGB(){return this.bg&268435456&&~this.extended.underlineColor?(this.extended.underlineColor&50331648)==50331648:this.isFgRGB()}isUnderlineColorPalette(){return this.bg&268435456&&~this.extended.underlineColor?(this.extended.underlineColor&50331648)==16777216||(this.extended.underlineColor&50331648)==33554432:this.isFgPalette()}isUnderlineColorDefault(){return this.bg&268435456&&~this.extended.underlineColor?!(this.extended.underlineColor&50331648):this.isFgDefault()}getUnderlineStyle(){return this.fg&268435456?this.bg&268435456?this.extended.underlineStyle:1:0}getUnderlineVariantOffset(){return this.extended.underlineVariantOffset}},Ce=class e{constructor(e=0,t=0){this._ext=0,this._urlId=0,this._ext=e,this._urlId=t}get ext(){return this._urlId?this._ext&-469762049|this.underlineStyle<<26:this._ext}set ext(e){this._ext=e}get underlineStyle(){return this._urlId?5:(this._ext&469762048)>>26}set underlineStyle(e){this._ext&=-469762049,this._ext|=e<<26&469762048}get underlineColor(){return this._ext&67108863}set underlineColor(e){this._ext&=-67108864,this._ext|=e&67108863}get urlId(){return this._urlId}set urlId(e){this._urlId=e}get underlineVariantOffset(){let e=(this._ext&3758096384)>>29;return e<0?e^4294967288:e}set underlineVariantOffset(e){this._ext&=536870911,this._ext|=e<<29&3758096384}clone(){return new e(this._ext,this._urlId)}isEmpty(){return this.underlineStyle===0&&this._urlId===0}},C=class e extends Se{constructor(){super(...arguments),this.content=0,this.fg=0,this.bg=0,this.extended=new Ce,this.combinedData=``}static fromCharData(t){let n=new e;return n.setFromCharData(t),n}isCombined(){return this.content&2097152}getWidth(){return this.content>>22}getChars(){return this.content&2097152?this.combinedData:this.content&2097151?S(this.content&2097151):``}getCode(){return this.isCombined()?this.combinedData.charCodeAt(this.combinedData.length-1):this.content&2097151}setFromCharData(e){this.fg=e[0],this.bg=0;let t=!1;if(e[1].length>2)t=!0;else if(e[1].length===2){let n=e[1].charCodeAt(0);if(55296<=n&&n<=56319){let r=e[1].charCodeAt(1);56320<=r&&r<=57343?this.content=(n-55296)*1024+r-56320+65536|e[2]<<22:t=!0}else t=!0}else this.content=e[1].charCodeAt(0)|e[2]<<22;t&&(this.combinedData=e[1],this.content=2097152|e[2]<<22)}getAsCharData(){return[this.fg,this.getChars(),this.getWidth(),this.getCode()]}},we=`di$target`,Te=`di$dependencies`,Ee=new Map;function De(e){return e[Te]||[]}function w(e){if(Ee.has(e))return Ee.get(e);let t=function(e,n,r){if(arguments.length!==3)throw Error(`@IServiceName-decorator can only be used to decorate a parameter`);Oe(t,e,r)};return t._id=e,Ee.set(e,t),t}function Oe(e,t,n){t[we]===t?t[Te].push({id:e,index:n}):(t[Te]=[{id:e,index:n}],t[we]=t)}var T=w(`BufferService`),ke=w(`CoreMouseService`),Ae=w(`CoreService`),je=w(`CharsetService`),Me=w(`InstantiationService`),Ne=w(`LogService`),E=w(`OptionsService`),Pe=w(`OscLinkService`),Fe=w(`UnicodeService`),Ie=w(`DecorationService`),Le=class{constructor(e,t,n){this._bufferService=e,this._optionsService=t,this._oscLinkService=n}provideLinks(e,t){let n=this._bufferService.buffer.lines.get(e-1);if(!n){t(void 0);return}let r=[],i=this._optionsService.rawOptions.linkHandler,a=new C,o=n.getTrimmedLength(),s=-1,c=-1,l=!1;for(let t=0;t<o;t++)if(c!==-1||n.hasContent(t)){if(n.loadCell(t,a),a.hasExtendedAttrs()&&a.extended.urlId){if(c===-1){c=t,s=a.extended.urlId;continue}l=a.extended.urlId!==s}else c!==-1&&(l=!0);if(l||c!==-1&&t===o-1){let n=this._oscLinkService.getLinkData(s)?.uri;if(n){let a={start:{x:c+1,y:e},end:{x:t+ +(!l&&t===o-1),y:e}},s=!1;if(!i?.allowNonHttpProtocols)try{let e=new URL(n);[`http:`,`https:`].includes(e.protocol)||(s=!0)}catch{s=!0}s||r.push({text:n,range:a,activate:(e,t)=>i?i.activate(e,t,a):Re(e,t),hover:(e,t)=>i?.hover?.(e,t,a),leave:(e,t)=>i?.leave?.(e,t,a)})}l=!1,a.hasExtendedAttrs()&&a.extended.urlId?(c=t,s=a.extended.urlId):(c=-1,s=-1)}}t(r)}};Le=v([y(0,T),y(1,E),y(2,Pe)],Le);function Re(e,t){if(confirm(`Do you want to navigate to ${t}?
1
+ import{r as e}from"./rolldown-runtime-hePW80VL.js";import{n as t,t as n}from"./jsx-runtime-BNakU3Ej.js";import{O as r}from"./logo-C4V2_3Ar.js";import{t as i}from"./useMutation-DKyQXgyj.js";import{Ct as a,Mt as o,Qt as s,a as c,f as l,rt as u,yt as d}from"./ui-SKtUMhUq.js";import{B as f}from"./index-CsKV2ZNO.js";var p=e(t(),1),m=2,h=1,g=class{activate(e){this._terminal=e}dispose(){}fit(){let e=this.proposeDimensions();if(!e||!this._terminal||isNaN(e.cols)||isNaN(e.rows))return;let t=this._terminal._core;(this._terminal.rows!==e.rows||this._terminal.cols!==e.cols)&&(t._renderService.clear(),this._terminal.resize(e.cols,e.rows))}proposeDimensions(){if(!this._terminal||!this._terminal.element||!this._terminal.element.parentElement)return;let e=this._terminal._core._renderService.dimensions;if(e.css.cell.width===0||e.css.cell.height===0)return;let t=this._terminal.options.scrollback===0?0:this._terminal.options.overviewRuler?.width||14,n=window.getComputedStyle(this._terminal.element.parentElement),r=parseInt(n.getPropertyValue(`height`)),i=Math.max(0,parseInt(n.getPropertyValue(`width`))),a=window.getComputedStyle(this._terminal.element),o={top:parseInt(a.getPropertyValue(`padding-top`)),bottom:parseInt(a.getPropertyValue(`padding-bottom`)),right:parseInt(a.getPropertyValue(`padding-right`)),left:parseInt(a.getPropertyValue(`padding-left`))},s=o.top+o.bottom,c=o.right+o.left,l=r-s,u=i-c-t;return{cols:Math.max(m,Math.floor(u/e.css.cell.width)),rows:Math.max(h,Math.floor(l/e.css.cell.height))}}},_=class{constructor(e,t,n,r={}){this._terminal=e,this._regex=t,this._handler=n,this._options=r}provideLinks(e,t){let n=te.computeLink(e,this._regex,this._terminal,this._handler);t(this._addCallbacks(n))}_addCallbacks(e){return e.map(e=>(e.leave=this._options.leave,e.hover=(t,n)=>{if(this._options.hover){let{range:r}=e;this._options.hover(t,n,r)}},e))}};function ee(e){try{let t=new URL(e),n=t.password&&t.username?`${t.protocol}//${t.username}:${t.password}@${t.host}`:t.username?`${t.protocol}//${t.username}@${t.host}`:`${t.protocol}//${t.host}`;return e.toLocaleLowerCase().startsWith(n.toLocaleLowerCase())}catch{return!1}}var te=class e{static computeLink(t,n,r,i){let a=new RegExp(n.source,(n.flags||``)+`g`),[o,s]=e._getWindowedLineStrings(t-1,r),c=o.join(``),l,u=[];for(;l=a.exec(c);){let t=l[0];if(!ee(t))continue;let[n,a]=e._mapStrIdx(r,s,0,l.index),[o,c]=e._mapStrIdx(r,n,a,t.length);if(n===-1||a===-1||o===-1||c===-1)continue;let d={start:{x:a+1,y:n+1},end:{x:c,y:o+1}};u.push({range:d,text:t,activate:i})}return u}static _getWindowedLineStrings(e,t){let n,r=e,i=e,a=0,o=``,s=[];if(n=t.buffer.active.getLine(e)){let e=n.translateToString(!0);if(n.isWrapped&&e[0]!==` `){for(a=0;(n=t.buffer.active.getLine(--r))&&a<2048&&(o=n.translateToString(!0),a+=o.length,s.push(o),n.isWrapped&&o.indexOf(` `)===-1););s.reverse()}for(s.push(e),a=0;(n=t.buffer.active.getLine(++i))&&n.isWrapped&&a<2048&&(o=n.translateToString(!0),a+=o.length,s.push(o),o.indexOf(` `)===-1););}return[s,r]}static _mapStrIdx(e,t,n,r){let i=e.buffer.active,a=i.getNullCell(),o=n;for(;r;){let e=i.getLine(t);if(!e)return[-1,-1];for(let n=o;n<e.length;++n){e.getCell(n,a);let o=a.getChars();if(a.getWidth()&&(r-=o.length||1,n===e.length-1&&o===``)){let e=i.getLine(t+1);e&&e.isWrapped&&(e.getCell(0,a),a.getWidth()===2&&(r+=1))}if(r<0)return[t,n]}t++,o=0}return[t,o]}},ne=/(https?|HTTPS?):[/]{2}[^\s"'!*(){}|\\\^<>`]*[^\s"':,.!?{}|\\\^~\[\]`()<>]/;function re(e,t){let n=window.open();if(n){try{n.opener=null}catch{}n.location.href=t}else console.warn(`Opening link blocked as opener could not be cleared`)}var ie=class{constructor(e=re,t={}){this._handler=e,this._options=t}activate(e){this._terminal=e;let t=this._options,n=t.urlRegex||ne;this._linkProvider=this._terminal.registerLinkProvider(new _(this._terminal,n,this._handler,t))}dispose(){this._linkProvider?.dispose()}},ae=Object.defineProperty,oe=Object.getOwnPropertyDescriptor,se=(e,t)=>{for(var n in t)ae(e,n,{get:t[n],enumerable:!0})},v=(e,t,n,r)=>{for(var i=r>1?void 0:r?oe(t,n):t,a=e.length-1,o;a>=0;a--)(o=e[a])&&(i=(r?o(t,n,i):o(i))||i);return r&&i&&ae(t,n,i),i},y=(e,t)=>(n,r)=>t(n,r,e),ce=`Terminal input`,b={get:()=>ce,set:e=>ce=e},le=`Too much output to announce, navigate to rows manually to read`,ue={get:()=>le,set:e=>le=e};function de(e){return e.replace(/\r?\n/g,`\r`)}function x(e,t){return t?`\x1B[200~`+e+`\x1B[201~`:e}function fe(e,t){e.clipboardData&&e.clipboardData.setData(`text/plain`,t.selectionText),e.preventDefault()}function pe(e,t,n,r){e.stopPropagation(),e.clipboardData&&me(e.clipboardData.getData(`text/plain`),t,n,r)}function me(e,t,n,r){e=de(e),e=x(e,n.decPrivateModes.bracketedPasteMode&&r.rawOptions.ignoreBracketedPasteMode!==!0),n.triggerDataEvent(e,!0),t.value=``}function he(e,t,n){let r=n.getBoundingClientRect(),i=e.clientX-r.left-10,a=e.clientY-r.top-10;t.style.width=`20px`,t.style.height=`20px`,t.style.left=`${i}px`,t.style.top=`${a}px`,t.style.zIndex=`1000`,t.focus()}function ge(e,t,n,r,i){he(e,t,n),i&&r.rightClickSelect(e),t.value=r.selectionText,t.select()}function S(e){return e>65535?(e-=65536,String.fromCharCode((e>>10)+55296)+String.fromCharCode(e%1024+56320)):String.fromCharCode(e)}function _e(e,t=0,n=e.length){let r=``;for(let i=t;i<n;++i){let t=e[i];t>65535?(t-=65536,r+=String.fromCharCode((t>>10)+55296)+String.fromCharCode(t%1024+56320)):r+=String.fromCharCode(t)}return r}var ve=class{constructor(){this._interim=0}clear(){this._interim=0}decode(e,t){let n=e.length;if(!n)return 0;let r=0,i=0;if(this._interim){let n=e.charCodeAt(i++);56320<=n&&n<=57343?t[r++]=(this._interim-55296)*1024+n-56320+65536:(t[r++]=this._interim,t[r++]=n),this._interim=0}for(let a=i;a<n;++a){let i=e.charCodeAt(a);if(55296<=i&&i<=56319){if(++a>=n)return this._interim=i,r;let o=e.charCodeAt(a);56320<=o&&o<=57343?t[r++]=(i-55296)*1024+o-56320+65536:(t[r++]=i,t[r++]=o);continue}i!==65279&&(t[r++]=i)}return r}},ye=class{constructor(){this.interim=new Uint8Array(3)}clear(){this.interim.fill(0)}decode(e,t){let n=e.length;if(!n)return 0;let r=0,i,a,o,s,c=0,l=0;if(this.interim[0]){let i=!1,a=this.interim[0];a&=(a&224)==192?31:(a&240)==224?15:7;let o=0,s;for(;(s=this.interim[++o]&63)&&o<4;)a<<=6,a|=s;let c=(this.interim[0]&224)==192?2:(this.interim[0]&240)==224?3:4,u=c-o;for(;l<u;){if(l>=n)return 0;if(s=e[l++],(s&192)!=128){l--,i=!0;break}this.interim[o++]=s,a<<=6,a|=s&63}i||(c===2?a<128?l--:t[r++]=a:c===3?a<2048||a>=55296&&a<=57343||a===65279||(t[r++]=a):a<65536||a>1114111||(t[r++]=a)),this.interim.fill(0)}let u=n-4,d=l;for(;d<n;){for(;d<u&&!((i=e[d])&128)&&!((a=e[d+1])&128)&&!((o=e[d+2])&128)&&!((s=e[d+3])&128);)t[r++]=i,t[r++]=a,t[r++]=o,t[r++]=s,d+=4;if(i=e[d++],i<128)t[r++]=i;else if((i&224)==192){if(d>=n)return this.interim[0]=i,r;if(a=e[d++],(a&192)!=128){d--;continue}if(c=(i&31)<<6|a&63,c<128){d--;continue}t[r++]=c}else if((i&240)==224){if(d>=n)return this.interim[0]=i,r;if(a=e[d++],(a&192)!=128){d--;continue}if(d>=n)return this.interim[0]=i,this.interim[1]=a,r;if(o=e[d++],(o&192)!=128){d--;continue}if(c=(i&15)<<12|(a&63)<<6|o&63,c<2048||c>=55296&&c<=57343||c===65279)continue;t[r++]=c}else if((i&248)==240){if(d>=n)return this.interim[0]=i,r;if(a=e[d++],(a&192)!=128){d--;continue}if(d>=n)return this.interim[0]=i,this.interim[1]=a,r;if(o=e[d++],(o&192)!=128){d--;continue}if(d>=n)return this.interim[0]=i,this.interim[1]=a,this.interim[2]=o,r;if(s=e[d++],(s&192)!=128){d--;continue}if(c=(i&7)<<18|(a&63)<<12|(o&63)<<6|s&63,c<65536||c>1114111)continue;t[r++]=c}}return r}},be=``,xe=` `,Se=class e{constructor(){this.fg=0,this.bg=0,this.extended=new Ce}static toColorRGB(e){return[e>>>16&255,e>>>8&255,e&255]}static fromColorRGB(e){return(e[0]&255)<<16|(e[1]&255)<<8|e[2]&255}clone(){let t=new e;return t.fg=this.fg,t.bg=this.bg,t.extended=this.extended.clone(),t}isInverse(){return this.fg&67108864}isBold(){return this.fg&134217728}isUnderline(){return this.hasExtendedAttrs()&&this.extended.underlineStyle!==0?1:this.fg&268435456}isBlink(){return this.fg&536870912}isInvisible(){return this.fg&1073741824}isItalic(){return this.bg&67108864}isDim(){return this.bg&134217728}isStrikethrough(){return this.fg&2147483648}isProtected(){return this.bg&536870912}isOverline(){return this.bg&1073741824}getFgColorMode(){return this.fg&50331648}getBgColorMode(){return this.bg&50331648}isFgRGB(){return(this.fg&50331648)==50331648}isBgRGB(){return(this.bg&50331648)==50331648}isFgPalette(){return(this.fg&50331648)==16777216||(this.fg&50331648)==33554432}isBgPalette(){return(this.bg&50331648)==16777216||(this.bg&50331648)==33554432}isFgDefault(){return!(this.fg&50331648)}isBgDefault(){return!(this.bg&50331648)}isAttributeDefault(){return this.fg===0&&this.bg===0}getFgColor(){switch(this.fg&50331648){case 16777216:case 33554432:return this.fg&255;case 50331648:return this.fg&16777215;default:return-1}}getBgColor(){switch(this.bg&50331648){case 16777216:case 33554432:return this.bg&255;case 50331648:return this.bg&16777215;default:return-1}}hasExtendedAttrs(){return this.bg&268435456}updateExtended(){this.extended.isEmpty()?this.bg&=-268435457:this.bg|=268435456}getUnderlineColor(){if(this.bg&268435456&&~this.extended.underlineColor)switch(this.extended.underlineColor&50331648){case 16777216:case 33554432:return this.extended.underlineColor&255;case 50331648:return this.extended.underlineColor&16777215;default:return this.getFgColor()}return this.getFgColor()}getUnderlineColorMode(){return this.bg&268435456&&~this.extended.underlineColor?this.extended.underlineColor&50331648:this.getFgColorMode()}isUnderlineColorRGB(){return this.bg&268435456&&~this.extended.underlineColor?(this.extended.underlineColor&50331648)==50331648:this.isFgRGB()}isUnderlineColorPalette(){return this.bg&268435456&&~this.extended.underlineColor?(this.extended.underlineColor&50331648)==16777216||(this.extended.underlineColor&50331648)==33554432:this.isFgPalette()}isUnderlineColorDefault(){return this.bg&268435456&&~this.extended.underlineColor?!(this.extended.underlineColor&50331648):this.isFgDefault()}getUnderlineStyle(){return this.fg&268435456?this.bg&268435456?this.extended.underlineStyle:1:0}getUnderlineVariantOffset(){return this.extended.underlineVariantOffset}},Ce=class e{constructor(e=0,t=0){this._ext=0,this._urlId=0,this._ext=e,this._urlId=t}get ext(){return this._urlId?this._ext&-469762049|this.underlineStyle<<26:this._ext}set ext(e){this._ext=e}get underlineStyle(){return this._urlId?5:(this._ext&469762048)>>26}set underlineStyle(e){this._ext&=-469762049,this._ext|=e<<26&469762048}get underlineColor(){return this._ext&67108863}set underlineColor(e){this._ext&=-67108864,this._ext|=e&67108863}get urlId(){return this._urlId}set urlId(e){this._urlId=e}get underlineVariantOffset(){let e=(this._ext&3758096384)>>29;return e<0?e^4294967288:e}set underlineVariantOffset(e){this._ext&=536870911,this._ext|=e<<29&3758096384}clone(){return new e(this._ext,this._urlId)}isEmpty(){return this.underlineStyle===0&&this._urlId===0}},C=class e extends Se{constructor(){super(...arguments),this.content=0,this.fg=0,this.bg=0,this.extended=new Ce,this.combinedData=``}static fromCharData(t){let n=new e;return n.setFromCharData(t),n}isCombined(){return this.content&2097152}getWidth(){return this.content>>22}getChars(){return this.content&2097152?this.combinedData:this.content&2097151?S(this.content&2097151):``}getCode(){return this.isCombined()?this.combinedData.charCodeAt(this.combinedData.length-1):this.content&2097151}setFromCharData(e){this.fg=e[0],this.bg=0;let t=!1;if(e[1].length>2)t=!0;else if(e[1].length===2){let n=e[1].charCodeAt(0);if(55296<=n&&n<=56319){let r=e[1].charCodeAt(1);56320<=r&&r<=57343?this.content=(n-55296)*1024+r-56320+65536|e[2]<<22:t=!0}else t=!0}else this.content=e[1].charCodeAt(0)|e[2]<<22;t&&(this.combinedData=e[1],this.content=2097152|e[2]<<22)}getAsCharData(){return[this.fg,this.getChars(),this.getWidth(),this.getCode()]}},we=`di$target`,Te=`di$dependencies`,Ee=new Map;function De(e){return e[Te]||[]}function w(e){if(Ee.has(e))return Ee.get(e);let t=function(e,n,r){if(arguments.length!==3)throw Error(`@IServiceName-decorator can only be used to decorate a parameter`);Oe(t,e,r)};return t._id=e,Ee.set(e,t),t}function Oe(e,t,n){t[we]===t?t[Te].push({id:e,index:n}):(t[Te]=[{id:e,index:n}],t[we]=t)}var T=w(`BufferService`),ke=w(`CoreMouseService`),Ae=w(`CoreService`),je=w(`CharsetService`),Me=w(`InstantiationService`),Ne=w(`LogService`),E=w(`OptionsService`),Pe=w(`OscLinkService`),Fe=w(`UnicodeService`),Ie=w(`DecorationService`),Le=class{constructor(e,t,n){this._bufferService=e,this._optionsService=t,this._oscLinkService=n}provideLinks(e,t){let n=this._bufferService.buffer.lines.get(e-1);if(!n){t(void 0);return}let r=[],i=this._optionsService.rawOptions.linkHandler,a=new C,o=n.getTrimmedLength(),s=-1,c=-1,l=!1;for(let t=0;t<o;t++)if(c!==-1||n.hasContent(t)){if(n.loadCell(t,a),a.hasExtendedAttrs()&&a.extended.urlId){if(c===-1){c=t,s=a.extended.urlId;continue}l=a.extended.urlId!==s}else c!==-1&&(l=!0);if(l||c!==-1&&t===o-1){let n=this._oscLinkService.getLinkData(s)?.uri;if(n){let a={start:{x:c+1,y:e},end:{x:t+ +(!l&&t===o-1),y:e}},s=!1;if(!i?.allowNonHttpProtocols)try{let e=new URL(n);[`http:`,`https:`].includes(e.protocol)||(s=!0)}catch{s=!0}s||r.push({text:n,range:a,activate:(e,t)=>i?i.activate(e,t,a):Re(e,t),hover:(e,t)=>i?.hover?.(e,t,a),leave:(e,t)=>i?.leave?.(e,t,a)})}l=!1,a.hasExtendedAttrs()&&a.extended.urlId?(c=t,s=a.extended.urlId):(c=-1,s=-1)}}t(r)}};Le=v([y(0,T),y(1,E),y(2,Pe)],Le);function Re(e,t){if(confirm(`Do you want to navigate to ${t}?
2
2
 
3
3
  WARNING: This link could potentially be dangerous`)){let e=window.open();if(e){try{e.opener=null}catch{}e.location.href=t}else console.warn(`Opening link blocked as opener could not be cleared`)}}var ze=w(`CharSizeService`),Be=w(`CoreBrowserService`),Ve=w(`MouseService`),He=w(`RenderService`),Ue=w(`SelectionService`),We=w(`CharacterJoinerService`),Ge=w(`ThemeService`),Ke=w(`LinkProviderService`),qe=new class{constructor(){this.listeners=[],this.unexpectedErrorHandler=function(e){setTimeout(()=>{throw e.stack?$e.isErrorNoTelemetry(e)?new $e(e.message+`
4
4
 
@@ -1,2 +1,2 @@
1
- const __vite__mapDeps=(i,m=__vite__mapDeps,d=(m.f||(m.f=["assets/FlowPreview-DbwvacRX.js","assets/rolldown-runtime-hePW80VL.js","assets/jsx-runtime-BNakU3Ej.js","assets/ui-FW7ypPI6.js","assets/preload-helper-CNEI7N0N.js","assets/esm-BW4CnGD3.js","assets/index-cEhTXa2U.js","assets/logo-C4V2_3Ar.js","assets/engenty-eXZ-EAwd.js","assets/useMutation-DKyQXgyj.js","assets/brand-DIKyySmf.js","assets/volume-2-B1mj20eS.js","assets/session-CSbo-pmx.js","assets/index-DVnigS8k.css"])))=>i.map(i=>d[i]);
2
- import{r as e}from"./rolldown-runtime-hePW80VL.js";import{n as t,t as n}from"./jsx-runtime-BNakU3Ej.js";import{O as r,a as i,c as a,i as o,r as s,s as c,v as l}from"./logo-C4V2_3Ar.js";import{t as u}from"./useMutation-DKyQXgyj.js";import{t as d}from"./preload-helper-CNEI7N0N.js";import{$t as f,Ct as p,Et as m,It as h,Jt as g,Qt as _,Rt as ee,Tt as v,Ut as y,Zt as te,a as b,at as x,fn as ne,in as S,it as C,mt as w,ot as T,rt as E,xt as D,yt as O,zt as re}from"./ui-FW7ypPI6.js";import{l as k,r as ie}from"./brand-DIKyySmf.js";import{t as ae}from"./volume-2-B1mj20eS.js";import{l as oe,u as se}from"./engenty-eXZ-EAwd.js";var ce=class extends i{constructor(e,t){super(e,t)}bindMethods(){super.bindMethods(),this.fetchNextPage=this.fetchNextPage.bind(this),this.fetchPreviousPage=this.fetchPreviousPage.bind(this)}setOptions(e){e._type=`infinite`,super.setOptions(e)}getOptimisticResult(e){return e._type=`infinite`,super.getOptimisticResult(e)}fetchNextPage(e){return this.fetch({...e,meta:{fetchMore:{direction:`forward`}}})}fetchPreviousPage(e){return this.fetch({...e,meta:{fetchMore:{direction:`backward`}}})}createResult(e,t){let{state:n}=e,r=super.createResult(e,t),{isFetching:i,isRefetching:o,isError:s,isRefetchError:l}=r,u=n.fetchMeta?.fetchMore?.direction,d=s&&u===`forward`,f=i&&u===`forward`,p=s&&u===`backward`,m=i&&u===`backward`;return{...r,fetchNextPage:this.fetchNextPage,fetchPreviousPage:this.fetchPreviousPage,hasNextPage:c(t,n.data),hasPreviousPage:a(t,n.data),isFetchNextPageError:d,isFetchingNextPage:f,isFetchPreviousPageError:p,isFetchingPreviousPage:m,isRefetchError:l&&!d&&!p,isRefetching:o&&!f&&!m}}};function le(e,t){return o(e,ce,t)}var ue={name:`app-window`,size:24,node:[[`rect`,{x:`2`,y:`4`,width:`20`,height:`16`,rx:`2`,key:`izxlao`}],[`path`,{d:`M10 4v4`,key:`pp8u80`}],[`path`,{d:`M2 8h20`,key:`d11cs7`}],[`path`,{d:`M6 4v4`,key:`1svtjw`}]]};ue.node;var A=S(ue),de={name:`bot`,size:24,node:[[`path`,{d:`M12 8V4H8`,key:`hb8ula`}],[`rect`,{width:`16`,height:`12`,x:`4`,y:`8`,rx:`2`,key:`enze0r`}],[`path`,{d:`M2 14h2`,key:`vft8re`}],[`path`,{d:`M20 14h2`,key:`4cs60a`}],[`path`,{d:`M15 13v2`,key:`1xurst`}],[`path`,{d:`M9 13v2`,key:`rq6x2g`}]]};de.node;var j=S(de),fe={name:`chart-column`,size:24,node:[[`path`,{d:`M3 3v16a2 2 0 0 0 2 2h16`,key:`c24i48`}],[`path`,{d:`M18 17V9`,key:`2bz60n`}],[`path`,{d:`M13 17V5`,key:`1frdt8`}],[`path`,{d:`M8 17v-3`,key:`17ska0`}]],aliases:[`bar-chart-3`]};fe.node;var pe=S(fe),me={name:`circle-dollar-sign`,size:24,node:[[`circle`,{cx:`12`,cy:`12`,r:`10`,key:`1mglay`}],[`path`,{d:`M16 8h-6a2 2 0 1 0 0 4h4a2 2 0 1 1 0 4H8`,key:`1h4pet`}],[`path`,{d:`M12 18V6`,key:`zqpxq5`}]]};me.node;var he=S(me),ge={name:`circle-euro`,size:24,node:[[`path`,{d:`M15 9.4a4 4 0 1 0 0 5.2`,key:`1makmb`}],[`path`,{d:`M7 12h5`,key:`gblrwe`}],[`circle`,{cx:`12`,cy:`12`,r:`10`,key:`1mglay`}]]};ge.node;var _e=S(ge),ve={name:`clapperboard`,size:24,node:[[`path`,{d:`m12.296 3.464 3.02 3.956`,key:`qash78`}],[`path`,{d:`M20.2 6 3 11l-.9-2.4c-.3-1.1.3-2.2 1.3-2.5l13.5-4c1.1-.3 2.2.3 2.5 1.3z`,key:`1h7j8b`}],[`path`,{d:`M3 11h18v8a2 2 0 0 1-2 2H5a2 2 0 0 1-2-2z`,key:`4lm6w1`}],[`path`,{d:`m6.18 5.276 3.1 3.899`,key:`zjj9t3`}]]};ve.node;var M=S(ve),N={name:`cloud-off`,size:24,node:[[`path`,{d:`M10.94 5.274A7 7 0 0 1 15.71 10h1.79a4.5 4.5 0 0 1 4.222 6.057`,key:`1uxyv8`}],[`path`,{d:`M18.796 18.81A4.5 4.5 0 0 1 17.5 19H9A7 7 0 0 1 5.79 5.78`,key:`99tcn7`}],[`path`,{d:`m2 2 20 20`,key:`1ooewy`}]]};N.node;var P=S(N),F={name:`coins`,size:24,node:[[`path`,{d:`M13.744 17.736a6 6 0 1 1-7.48-7.48`,key:`bq4yh3`}],[`path`,{d:`M15 6h1v4`,key:`11y1tn`}],[`path`,{d:`m6.134 14.768.866-.5 2 3.464`,key:`17snzx`}],[`circle`,{cx:`16`,cy:`8`,r:`6`,key:`14bfc9`}]]};F.node;var ye=S(F),be={name:`eye`,size:24,node:[[`path`,{d:`M2.062 12.348a1 1 0 0 1 0-.696 10.75 10.75 0 0 1 19.876 0 1 1 0 0 1 0 .696 10.75 10.75 0 0 1-19.876 0`,key:`1nclc0`}],[`circle`,{cx:`12`,cy:`12`,r:`3`,key:`1v7zrd`}]]};be.node;var I=S(be),xe={name:`flag`,size:24,node:[[`path`,{d:`M4 22V4a1 1 0 0 1 .4-.8A6 6 0 0 1 8 2c3 0 5 2 7.333 2q2 0 3.067-.8A1 1 0 0 1 20 4v10a1 1 0 0 1-.4.8A6 6 0 0 1 16 16c-3 0-5-2-8-2a6 6 0 0 0-4 1.528`,key:`1jaruq`}]]};xe.node;var Se=S(xe),Ce={name:`globe`,size:24,node:[[`circle`,{cx:`12`,cy:`12`,r:`10`,key:`1mglay`}],[`path`,{d:`M12 2a14.5 14.5 0 0 0 0 20 14.5 14.5 0 0 0 0-20`,key:`13o1zl`}],[`path`,{d:`M2 12h20`,key:`9i4pu4`}]]};Ce.node;var we=S(Ce),Te={name:`image`,size:24,node:[[`rect`,{width:`18`,height:`18`,x:`3`,y:`3`,rx:`2`,ry:`2`,key:`1m3agn`}],[`circle`,{cx:`9`,cy:`9`,r:`2`,key:`af1f0g`}],[`path`,{d:`m21 15-3.086-3.086a2 2 0 0 0-2.828 0L6 21`,key:`1xmnt7`}]]};Te.node;var L=S(Te),Ee={name:`layout-dashboard`,size:24,node:[[`rect`,{width:`7`,height:`9`,x:`3`,y:`3`,rx:`1`,key:`10lvy0`}],[`rect`,{width:`7`,height:`5`,x:`14`,y:`3`,rx:`1`,key:`16une8`}],[`rect`,{width:`7`,height:`9`,x:`14`,y:`12`,rx:`1`,key:`1hutg5`}],[`rect`,{width:`7`,height:`5`,x:`3`,y:`16`,rx:`1`,key:`ldoo1y`}]]};Ee.node;var De=S(Ee),Oe={name:`layout-template`,size:24,node:[[`rect`,{width:`18`,height:`7`,x:`3`,y:`3`,rx:`1`,key:`f1a2em`}],[`rect`,{width:`9`,height:`7`,x:`3`,y:`14`,rx:`1`,key:`jqznyg`}],[`rect`,{width:`5`,height:`7`,x:`16`,y:`14`,rx:`1`,key:`q5h2i8`}]]};Oe.node;var ke=S(Oe),Ae={name:`list-checks`,size:24,node:[[`path`,{d:`M13 5h8`,key:`a7qcls`}],[`path`,{d:`M13 12h8`,key:`h98zly`}],[`path`,{d:`M13 19h8`,key:`c3s6r1`}],[`path`,{d:`m3 17 2 2 4-4`,key:`1jhpwq`}],[`path`,{d:`m3 7 2 2 4-4`,key:`1obspn`}]]};Ae.node;var R=S(Ae),je={name:`plug`,size:24,node:[[`path`,{d:`M12 22v-5`,key:`1ega77`}],[`path`,{d:`M15 8V2`,key:`18g5xt`}],[`path`,{d:`M17 8a1 1 0 0 1 1 1v4a4 4 0 0 1-4 4h-4a4 4 0 0 1-4-4V9a1 1 0 0 1 1-1z`,key:`1xoxul`}],[`path`,{d:`M9 8V2`,key:`14iosj`}]]};je.node;var Me=S(je),z={name:`puzzle`,size:24,node:[[`path`,{d:`M15.39 4.39a1 1 0 0 0 1.68-.474 2.5 2.5 0 1 1 3.014 3.015 1 1 0 0 0-.474 1.68l1.683 1.682a2.414 2.414 0 0 1 0 3.414L19.61 15.39a1 1 0 0 1-1.68-.474 2.5 2.5 0 1 0-3.014 3.015 1 1 0 0 1 .474 1.68l-1.683 1.682a2.414 2.414 0 0 1-3.414 0L8.61 19.61a1 1 0 0 0-1.68.474 2.5 2.5 0 1 1-3.014-3.015 1 1 0 0 0 .474-1.68l-1.683-1.682a2.414 2.414 0 0 1 0-3.414L4.39 8.61a1 1 0 0 1 1.68.474 2.5 2.5 0 1 0 3.014-3.015 1 1 0 0 1-.474-1.68l1.683-1.682a2.414 2.414 0 0 1 3.414 0z`,key:`w46dr5`}]]};z.node;var Ne=S(z),Pe={name:`scan-text`,size:24,node:[[`path`,{d:`M3 7V5a2 2 0 0 1 2-2h2`,key:`aa7l1z`}],[`path`,{d:`M17 3h2a2 2 0 0 1 2 2v2`,key:`4qcy5o`}],[`path`,{d:`M21 17v2a2 2 0 0 1-2 2h-2`,key:`6vwrx8`}],[`path`,{d:`M7 21H5a2 2 0 0 1-2-2v-2`,key:`ioqczr`}],[`path`,{d:`M7 8h8`,key:`1jbsf9`}],[`path`,{d:`M7 12h10`,key:`b7w52i`}],[`path`,{d:`M7 16h6`,key:`1vyc9m`}]]};Pe.node;var Fe=S(Pe),Ie={name:`search`,size:24,node:[[`path`,{d:`m21 21-4.34-4.34`,key:`14j7rj`}],[`circle`,{cx:`11`,cy:`11`,r:`8`,key:`4ej97u`}]]};Ie.node;var Le=S(Ie),Re={name:`star`,size:24,node:[[`path`,{d:`M11.525 2.295a.53.53 0 0 1 .95 0l2.31 4.679a2.123 2.123 0 0 0 1.595 1.16l5.166.756a.53.53 0 0 1 .294.904l-3.736 3.638a2.123 2.123 0 0 0-.611 1.878l.882 5.14a.53.53 0 0 1-.771.56l-4.618-2.428a2.122 2.122 0 0 0-1.973 0L6.396 21.01a.53.53 0 0 1-.77-.56l.881-5.139a2.122 2.122 0 0 0-.611-1.879L2.16 9.795a.53.53 0 0 1 .294-.906l5.165-.755a2.122 2.122 0 0 0 1.597-1.16z`,key:`r04s7s`}]]};Re.node;var B=S(Re),ze={name:`table-2`,size:24,node:[[`path`,{d:`M3 9h18`,key:`1pudct`}],[`path`,{d:`M9 3v18`,key:`fh3hqa`}],[`rect`,{x:`3`,y:`3`,width:`18`,height:`18`,rx:`2`,key:`h1oib`}]]};ze.node;var Be=S(ze),Ve={name:`terminal`,size:24,node:[[`path`,{d:`M12 19h8`,key:`baeox8`}],[`path`,{d:`m4 17 6-6-6-6`,key:`1yngyt`}]]};Ve.node;var He=S(Ve),Ue={name:`type`,size:24,node:[[`path`,{d:`M12 4v16`,key:`1654pz`}],[`path`,{d:`M4 7V5a1 1 0 0 1 1-1h14a1 1 0 0 1 1 1v2`,key:`e0r10z`}],[`path`,{d:`M9 20h6`,key:`s66wpe`}]]};Ue.node;var We=S(Ue),Ge={name:`wand-sparkles`,size:24,node:[[`path`,{d:`m21.64 3.64-1.28-1.28a1.21 1.21 0 0 0-1.72 0L2.36 18.64a1.21 1.21 0 0 0 0 1.72l1.28 1.28a1.2 1.2 0 0 0 1.72 0L21.64 5.36a1.2 1.2 0 0 0 0-1.72`,key:`ul74o6`}],[`path`,{d:`m14 7 3 3`,key:`1r5n42`}],[`path`,{d:`M5 6v4`,key:`ilb8ba`}],[`path`,{d:`M19 14v4`,key:`blhpug`}],[`path`,{d:`M10 2v2`,key:`7u0qdc`}],[`path`,{d:`M7 8H3`,key:`zfb6yr`}],[`path`,{d:`M21 16h-4`,key:`1cnmox`}],[`path`,{d:`M11 3H9`,key:`1obp7u`}]],aliases:[`wand-2`]};Ge.node;var V=S(Ge),H={text:{de:`Text`,en:`Text`},document:{de:`Dokument (PDF, Word)`,en:`Document (PDF, Word)`},table:{de:`Tabelle`,en:`Table`},image:{de:`Bild`,en:`Image`},video:{de:`Video`,en:`Video`},audio:{de:`Audio`,en:`Audio`},dashboard:{de:`Dashboard`,en:`Dashboard`}},Ke={any:{de:`Jede Branche`,en:`Any industry`},trades:{de:`Handwerk`,en:`Trades`},gastronomy:{de:`Gastronomie`,en:`Food service`},hospitality:{de:`Hotel & Tourismus`,en:`Hotels & tourism`},realEstate:{de:`Immobilien`,en:`Real estate`},retail:{de:`Handel`,en:`Retail`},health:{de:`Gesundheit`,en:`Health`},professional:{de:`Kanzlei & Beratung`,en:`Professional services`},agency:{de:`Agentur & Marketing`,en:`Agency & marketing`},events:{de:`Veranstaltungen`,en:`Events`},publicSector:{de:`Vereine & Öffentliches`,en:`Associations & public sector`}},qe={marketing:{de:`Marketing & Social Media`,en:`Marketing & social media`},sales:{de:`Angebote & Verkauf`,en:`Offers & sales`},accounting:{de:`Buchhaltung & Belege`,en:`Accounting & receipts`},service:{de:`Kundenservice`,en:`Customer service`},research:{de:`Recherche & Analyse`,en:`Research & analysis`},hr:{de:`Personal & Bewerbungen`,en:`HR & applications`},operations:{de:`Planung & Abläufe`,en:`Planning & operations`},website:{de:`Helfer für die Website`,en:`Website helpers`},visuals:{de:`Bilder & Video`,en:`Images & video`},inquiries:{de:`Anfragen & Termine`,en:`Inquiries & bookings`},advice:{de:`Beratung & Preise`,en:`Advice & pricing`}},U={text:{de:`Text schreiben`,en:`Writes text`},web:{de:`Websuche`,en:`Web search`},browser:{de:`Browser bedienen`,en:`Drives a browser`},documents:{de:`Dokumente & Fotos lesen`,en:`Reads documents & photos`},image:{de:`Bilder erzeugen`,en:`Makes images`},video:{de:`Videos erzeugen`,en:`Makes video`},speech:{de:`Sprachausgabe`,en:`Speech output`},listening:{de:`Sprachnotizen verstehen`,en:`Understands voice notes`},code:{de:`Code ausführen`,en:`Runs code`},connectors:{de:`Verbundene Konten & Systeme`,en:`Connected accounts & systems`},film:{de:`Filme mit Claude Code (auf deinem Abo)`,en:`Films with Claude Code (on your subscription)`}},Je={low:{de:`günstig`,en:`low cost`},medium:{de:`mittel`,en:`medium cost`},high:{de:`teuer`,en:`high cost`}},Ye={free:{de:`Kostenlos`,en:`Free`},pro:{de:`Pro`,en:`Pro`}},W=e=>Object.keys(e);W(H),W(Ke),W(qe),W(U),W(Ye);var G=e(t(),1);function Xe(e){switch(e.type){case`page`:return R;case`agent`:return j;case`generate`:return e.asset===`image`?L:e.asset===`video`?m:e.asset===`dashboard`?De:y;case`widget`:return A;case`surface`:return ke;case`film`:return M;case`review`:return I;case`result`:return Se}return V}var Ze={page:`bg-cobalt-tint text-cobalt`,agent:`bg-ember-tint text-ember-strong`,generate:`bg-amber-tint text-ink-2`,widget:`bg-ember-veil text-ember-strong`,surface:`bg-ember-veil text-ember-strong`,film:`bg-amber-tint text-ink-2`,review:`bg-moss-tint text-moss`,result:`bg-paper-2 text-ink-2`};function Qe(e){return p(`type.${e.type}`)}var $e=[`web_search`,`web_fetch`,`browser`,`sandbox`,`image`,`http`,`pages`];function et(e){return $e.includes(e)?p(`tool.${e}`):e}function tt(e){switch(e.type){case`page`:return e.fields.map(e=>e.label).join(` · `);case`agent`:{let t=e.tools.map(et),n=e.mcp?.length?[`MCP: ${e.mcp.join(`, `)}`]:[];return[...t,...n].join(` · `)||e.instructions.slice(0,90)}case`generate`:{let t=[e.asset];return e.options?.aspectRatio&&t.push(e.options.aspectRatio),e.options?.duration&&t.push(`${e.options.duration}s`),e.options?.resolution&&t.push(e.options.resolution),e.options?.template&&t.push(e.options.template),t.join(` · `)}case`widget`:return[e.entry,Object.keys(e.data).join(`, `)].filter(Boolean).join(` · `);case`surface`:return e.candidates?e.candidates.map(e=>e.id).join(` · `):Object.keys(e.data).join(`, `);case`film`:return[e.format,e.seconds?`${e.seconds}s`:null,e.skills.join(`, `)].filter(Boolean).join(` · `);case`review`:return[e.edit?p(`editor.reviewEditable`):null,e.regenerate?p(`editor.reviewRedo`):null].filter(Boolean).join(` · `);case`result`:return e.deliverables.map(e=>`${e.label??e.from} (${e.formats.join(`, `)})`).join(` · `)}return``}var K=e(n(),1),nt=(0,G.lazy)(()=>d(()=>import(`./FlowPreview-DbwvacRX.js`),__vite__mapDeps([0,1,2,3,4,5,6,7,8,9,10,11,12,13]))),rt={useCase:``,industry:``,format:``,capability:``,plan:``},q=(e,t)=>e[t]?.[D]??t;function it(e){if(e<1)return 1;let t=10**Math.floor(Math.log10(e));return Math.round(e/t)*t}function at(e){return e.credits?p(`market.credits`,{n:it(e.credits.credits)}):Je[e.costTier][D]}var ot={text:We,document:y,table:Be,image:L,video:m,audio:f,dashboard:pe};function J({format:e,className:t}){let n=ot[e],r=q(H,e);return(0,K.jsx)(`span`,{title:r,className:`inline-flex`,children:(0,K.jsx)(n,{className:t,"aria-label":r,role:`img`})})}var st=[`low`,`medium`,`high`];function Y({entry:e}){let t=st.indexOf(e.costTier)+1,n=D===`de`?_e:he;return(0,K.jsxs)(`span`,{title:at(e),className:`inline-flex items-center gap-1`,children:[(0,K.jsx)(`span`,{"aria-hidden":`true`,className:`inline-flex shrink-0`,children:st.slice(0,t).map((e,t)=>(0,K.jsx)(`span`,{className:O(`rounded-full bg-(--coin-bg,var(--color-card))`,t>0&&`-ml-1.5`),children:(0,K.jsx)(n,{className:`size-4`})},e))}),Je[e.costTier][D]]})}function ct(){return(0,K.jsx)(x,{tone:`ember`,title:p(`market.proHint`),children:p(`market.pro`)})}function lt({plugin:e}){return(0,K.jsx)(x,{icon:(0,K.jsx)(Ne,{className:`size-3.5`}),title:p(`market.fromPlugin`,{name:e.name}),children:e.name})}function ut({entry:e,onOpen:t}){return(0,K.jsxs)(C,{role:`button`,tabIndex:0,onClick:t,onKeyDown:e=>{(e.key===`Enter`||e.key===` `)&&(e.preventDefault(),t())},className:O(`relative flex min-h-[124px] cursor-pointer flex-col gap-5 p-4 text-left transition sm:min-h-[136px] sm:p-5 hover:shadow-elevated focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-focus`,(!e.usable||e.missing.length>0||!!e.needs?.length)&&`opacity-60`),children:[(0,K.jsx)(`span`,{className:`-top-4 pointer-events-none absolute right-4`,children:(0,K.jsx)(ie,{kind:e.avatar,size:68})}),(0,K.jsxs)(`div`,{className:`min-w-0 pr-20`,children:[(0,K.jsxs)(`div`,{className:`flex items-center gap-1.5 font-display font-semibold text-[0.9375rem]`,children:[e.title,e.plan===`pro`?(0,K.jsx)(ct,{}):null,e.starred?(0,K.jsx)(B,{className:`size-3.5 shrink-0 fill-amber text-amber`,"aria-label":p(`market.starred`)}):null]}),(0,K.jsx)(`div`,{className:`mt-0.5 text-[0.8125rem] text-ink-3 leading-snug`,children:e.pitch})]}),(0,K.jsxs)(`div`,{className:`mt-auto flex flex-wrap items-center gap-x-3 gap-y-1.5 text-[0.75rem] text-ink-3`,children:[e.plugin?(0,K.jsx)(lt,{plugin:e.plugin}):null,e.needs?.length?(0,K.jsx)(x,{tone:`warn`,children:p(`market.needsPro`,{list:e.needs.join(`, `)})}):e.usable&&e.missing.length?(0,K.jsx)(x,{tone:`warn`,children:p(`market.missing`,{list:Z(e.missing)})}):e.usable?(0,K.jsxs)(K.Fragment,{children:[(0,K.jsxs)(`span`,{className:`inline-flex items-center gap-1`,children:[(0,K.jsx)(g,{className:`size-3.5`}),` `,p(`market.minutes`,{n:e.effort.minutes})]}),(0,K.jsx)(Y,{entry:e}),e.optional?.length?(0,K.jsx)(x,{title:p(`market.optionalHint`,{list:Z(e.optional)}),children:p(`market.without`,{list:Z(e.optional)})}):null,(0,K.jsx)(`span`,{className:`ml-auto inline-flex items-center gap-1.5`,children:e.formats.map(e=>(0,K.jsx)(J,{format:e,className:`size-4`},e))})]}):(0,K.jsx)(x,{tone:`warn`,children:p(`market.needsUpdate`)})]})]})}function X({title:e,children:t}){return(0,K.jsxs)(`div`,{children:[(0,K.jsx)(`div`,{className:`mb-1.5 font-medium text-[0.75rem] text-ink-3 uppercase tracking-[0.06em]`,children:e}),t]})}var Z=e=>e.map(e=>q(U,e)).join(`, `),dt={text:h,web:we,browser:ee,documents:Fe,image:L,video:m,speech:ae,listening:re,code:He,connectors:Me,film:M};function ft(e){switch(e.type){case`page`:return R;case`agent`:return j;case`generate`:return e.asset===`image`?L:e.asset===`video`?m:e.asset===`voice`?ae:e.asset===`dashboard`?pe:y;case`widget`:return e.video?M:A;case`surface`:return A;case`film`:return M;case`review`:return I;case`result`:return Se}return V}function pt(e){let t=new Set;for(let[n,r]of e.entries())for(let i of r.branches??[]){let r=i.to===`end`?e.length:e.findIndex(e=>e.id===i.to);for(let i=n+1;i<r;i++)t.add(e[i].id)}return t}function mt(e){let t=pt(e);return e.map(e=>({id:e.id,title:e.title,icon:ft(e),tone:Ze[e.type]??`bg-paper-2 text-ink-2`,optional:t.has(e.id),branches:e.branches}))}function Q({title:e,children:t}){return(0,K.jsx)(`span`,{title:e,className:`inline-flex items-center gap-2 border-border border-l px-4 first:border-l-0 first:pl-0`,children:t})}function $({icon:e,children:t,more:n}){return(0,K.jsxs)(`div`,{className:`flex gap-2.5`,children:[(0,K.jsx)(`span`,{className:`mt-0.5 shrink-0`,children:e}),(0,K.jsxs)(`div`,{className:`min-w-0`,children:[(0,K.jsx)(`div`,{className:`text-[0.875rem] text-ink leading-snug`,children:t}),n?(0,K.jsx)(`div`,{className:`text-[0.75rem] text-ink-3 leading-snug`,children:n}):null]})]})}function ht({className:e,children:t}){let n=(0,G.useRef)(null),[r,i]=(0,G.useState)({above:!1,below:!1});(0,G.useEffect)(()=>{let e=n.current;if(!e)return;let t=()=>{let t=e.scrollTop>1,n=e.scrollTop+e.clientHeight<e.scrollHeight-1;i(e=>e.above===t&&e.below===n?e:{above:t,below:n})};t(),e.addEventListener(`scroll`,t,{passive:!0});let r=new ResizeObserver(t);return r.observe(e),e.firstElementChild&&r.observe(e.firstElementChild),()=>{e.removeEventListener(`scroll`,t),r.disconnect()}},[]);let a=`linear-gradient(to bottom, ${r.above?`transparent`:`black`} 0, black 28px, black calc(100% - 44px), ${r.below?`transparent`:`black`} 100%)`;return(0,K.jsx)(`div`,{ref:n,className:e,style:{maskImage:a,WebkitMaskImage:a},children:(0,K.jsx)(`div`,{children:t})})}function gt({id:e,fallback:t,onClose:n,onUse:i,busy:a}){let o=r(),c=ne(),l=s({queryKey:[`marketplace-entry`,e,D],queryFn:()=>b.get(`/api/studio/marketplace/${encodeURIComponent(e)}?lang=${D}`),enabled:!!e,retry:!1}),d=l.data??t,f=u({mutationFn:t=>{let n=`/api/studio/marketplace/${encodeURIComponent(e)}/star`;return t?b.put(n):b.del(n)},onSuccess:()=>Promise.all([o.invalidateQueries({queryKey:[`marketplace`]}),o.invalidateQueries({queryKey:[`marketplace-entry`,e]})])}),m=k()===`dark`,h=oe[se[d?.avatar||`round`]],_=m?`var(--card)`:`color-mix(in oklch, ${h??`var(--ink-4)`} 14%, var(--paper-2))`;return(0,K.jsx)(T,{open:!!e,onClose:n,wide:!0,bare:!0,children:d?(0,K.jsxs)(`div`,{className:`relative flex max-h-[calc(100dvh-48px)] flex-col rounded-2xl bg-card shadow-overlay max-sm:h-dvh max-sm:max-h-none max-sm:rounded-none`,children:[(0,K.jsx)(`button`,{type:`button`,"aria-label":p(`common.close`),onClick:n,className:`sm:-top-3.5 sm:-right-3.5 absolute top-3 right-3 z-20 flex size-9 items-center justify-center rounded-full bg-card text-ink-2 shadow-elevated ring-1 ring-border-soft transition hover:text-ink focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-focus`,children:(0,K.jsx)(v,{className:`size-4`})}),(0,K.jsxs)(`header`,{className:`relative shrink-0 border-border-soft border-b px-5 pt-5 pb-4 text-ink sm:rounded-t-2xl sm:px-7`,style:{background:_,"--coin-bg":_},children:[(0,K.jsx)(`span`,{"aria-hidden":`true`,className:`pointer-events-none absolute inset-0 overflow-hidden sm:rounded-t-2xl`,children:(0,K.jsx)(`span`,{className:O(`-top-28 -right-10 absolute size-80 rounded-full bg-white blur-3xl`,m?`opacity-[0.14]`:`opacity-80`)})}),(0,K.jsx)(`div`,{className:`-bottom-5 absolute right-9 z-10 max-sm:hidden`,children:(0,K.jsx)(ie,{kind:d.avatar,size:104})}),(0,K.jsxs)(`div`,{className:`relative sm:pr-36`,children:[(0,K.jsx)(`h2`,{className:`font-display font-semibold text-[1.375rem] leading-tight tracking-tight max-sm:pr-10`,children:d.title}),(0,K.jsx)(`p`,{className:`mt-1 text-[0.875rem] text-ink-2 leading-snug`,children:l.data?.description||d.pitch})]}),d.usable?(0,K.jsxs)(`div`,{className:`-mx-5 sm:-mx-7 relative mt-3.5 flex flex-wrap items-center gap-y-2 border-border-soft border-t px-5 pt-3 font-medium text-[0.875rem] sm:px-7 sm:pr-40`,children:[(0,K.jsxs)(Q,{title:p(`market.duration`),children:[(0,K.jsx)(g,{className:`size-4 text-ink-3`}),p(`market.minutes`,{n:d.effort.minutes})]}),(0,K.jsx)(Q,{title:p(`market.cost`),children:(0,K.jsx)(Y,{entry:d})}),(0,K.jsx)(Q,{title:p(`market.result`),children:d.formats.map(e=>(0,K.jsx)(J,{format:e,className:`size-4`},e))})]}):null]}),d.usable?(0,K.jsxs)(`div`,{className:`grid min-h-0 flex-1 gap-x-7 gap-y-6 px-5 pt-6 max-sm:overflow-y-auto max-sm:pb-4 sm:grid-cols-[230px_minmax(0,1fr)] sm:grid-rows-[minmax(0,1fr)] sm:px-7`,children:[(0,K.jsxs)(`div`,{className:`flex flex-col gap-5 sm:min-h-0 sm:overflow-y-auto`,children:[(0,K.jsx)(X,{title:p(`market.duration`),children:(0,K.jsx)($,{icon:(0,K.jsx)(g,{className:`size-4 text-moss`}),more:p(`market.durationHint`,{n:d.effort.fields}),children:p(`market.minutes`,{n:d.effort.minutes})})}),(0,K.jsx)(X,{title:p(`market.cost`),children:(0,K.jsx)($,{icon:(0,K.jsx)(ye,{className:`size-4 text-amber`}),more:d.credits?p(`market.creditsHint`):void 0,children:(0,K.jsxs)(`span`,{className:`flex flex-wrap items-center gap-x-2`,children:[(0,K.jsx)(Y,{entry:d}),d.credits?(0,K.jsx)(`span`,{className:`text-ink-2`,children:p(`market.creditsRange`,{n:it(d.credits.credits)})}):null]})})}),(0,K.jsx)(X,{title:p(`market.result`),children:(0,K.jsx)(`div`,{className:`flex flex-col gap-2`,children:(l.data?.results??[]).map(e=>(0,K.jsx)($,{icon:(0,K.jsx)(J,{format:e.kind,className:`size-4 text-ember-strong`}),more:e.formats.map(e=>e.toUpperCase()).join(` · `),children:e.title},e.title))})}),(0,K.jsx)(X,{title:p(`market.needs`),children:(0,K.jsx)(`ul`,{className:`flex flex-col gap-2`,children:d.capabilities.map(e=>{let t=dt[e],n=d.missing.includes(e),r=d.optional?.includes(e);return(0,K.jsxs)(`li`,{className:O(`flex items-center gap-2.5 text-[0.875rem]`,n?`text-ink-3`:`text-ink-2`),children:[(0,K.jsx)(t,{className:O(`size-4 shrink-0`,n?`text-rose`:r?`text-amber`:`text-cobalt`)}),q(U,e),n?(0,K.jsx)(`span`,{className:`text-[0.75rem] text-rose`,children:p(`market.unavailable`)}):r?(0,K.jsx)(`span`,{className:`text-[0.75rem] text-amber`,children:p(`market.optional`)}):null]},e)})})})]}),(0,K.jsxs)(`div`,{className:`flex flex-col sm:min-h-0`,children:[(0,K.jsx)(`div`,{className:`mb-1.5 shrink-0 font-medium text-[0.75rem] text-ink-3 uppercase tracking-[0.06em]`,children:p(`market.steps`)}),(0,K.jsx)(ht,{className:`-mr-2 overscroll-contain pt-1 pr-2 pl-1 sm:min-h-0 sm:flex-1 sm:overflow-y-auto`,children:l.isLoading?(0,K.jsx)(w,{className:`size-5 text-ink-3`}):(0,K.jsx)(G.Suspense,{fallback:(0,K.jsx)(w,{className:`size-5 text-ink-3`}),children:(0,K.jsx)(nt,{steps:mt(l.data?.outline??[])})})})]})]}):(0,K.jsx)(`div`,{className:`flex-1 px-5 pt-6 sm:px-7`,children:(0,K.jsx)(`p`,{className:`rounded-lg bg-amber-tint p-3 text-[0.875rem] text-ink-2`,children:p(`market.needsUpdateHint`)})}),(0,K.jsxs)(`div`,{className:`flex shrink-0 justify-end gap-2 px-5 pt-4 pb-5 max-sm:border-border-soft max-sm:border-t sm:px-7 sm:pb-6`,children:[d.plugin?(0,K.jsx)(`span`,{className:`mr-auto flex items-center`,children:(0,K.jsx)(lt,{plugin:d.plugin})}):(0,K.jsxs)(E,{variant:`ghost`,className:`mr-auto`,title:p(`market.starHint`),"aria-pressed":d.starred,busy:f.isPending,onClick:()=>f.mutate(!d.starred),children:[(0,K.jsx)(B,{className:O(`size-4`,d.starred&&`fill-amber text-amber`)}),(0,K.jsx)(`span`,{className:`max-sm:sr-only`,children:p(d.starred?`market.starred`:`market.star`)})]}),(0,K.jsx)(E,{variant:`secondary`,onClick:n,children:p(`common.close`)}),d.usable&&d.missing.length?(0,K.jsx)(E,{variant:`secondary`,onClick:()=>c(`/settings/models`),children:p(`editor.models.settings`)}):null,i?(0,K.jsx)(E,{disabled:!d.usable||d.missing.length>0||!!d.needs?.length,title:d.needs?.length?p(`market.needsProHint`,{list:d.needs.join(`, `)}):d.missing.length?p(`market.missingHint`,{list:Z(d.missing)}):d.optional?.length?p(`market.optionalHint`,{list:Z(d.optional)}):void 0,busy:a,onClick:()=>i(d),children:p(`market.use`)}):null]})]}):(0,K.jsx)(`div`,{className:`flex min-h-48 flex-col items-center justify-center gap-3 rounded-2xl bg-card p-8 text-[0.875rem] text-ink-2 shadow-overlay`,children:l.isLoading?(0,K.jsx)(w,{className:`size-6 text-ink-3`}):(0,K.jsxs)(K.Fragment,{children:[(0,K.jsx)(`p`,{children:p(`market.notFound`)}),(0,K.jsx)(E,{variant:`secondary`,onClick:n,children:p(`common.close`)})]})})})}function _t({name:e,value:t,options:n,onChange:r}){let[i,a]=(0,G.useState)(!1),o=(0,G.useRef)(null);(0,G.useEffect)(()=>{if(!i)return;let e=e=>{o.current?.contains(e.target)||a(!1)},t=e=>{e.key===`Escape`&&a(!1)};return document.addEventListener(`mousedown`,e),document.addEventListener(`keydown`,t),()=>{document.removeEventListener(`mousedown`,e),document.removeEventListener(`keydown`,t)}},[i]);let s=n.find(e=>e.value===t);return(0,K.jsxs)(`div`,{ref:o,className:`relative`,children:[(0,K.jsxs)(`div`,{className:O(`flex h-8 items-center rounded-full text-[0.8125rem] transition`,s?`bg-ember-tint text-ink`:`text-ink-2 hover:bg-paper-2 hover:text-ink`,i&&!s&&`bg-paper-2 text-ink`),children:[(0,K.jsx)(`button`,{type:`button`,"aria-haspopup":`listbox`,"aria-expanded":i,onClick:()=>a(!i),className:O(`flex h-full items-center gap-1.5 rounded-full pl-3 focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-focus`,s?`pr-1`:`pr-2.5`),children:s?(0,K.jsxs)(K.Fragment,{children:[(0,K.jsx)(`span`,{className:`text-ink-3`,children:e}),(0,K.jsx)(`span`,{className:`font-medium`,children:s.label})]}):(0,K.jsxs)(K.Fragment,{children:[e,(0,K.jsx)(te,{className:O(`size-3.5 transition`,i&&`rotate-180`)})]})}),s?(0,K.jsx)(`button`,{type:`button`,"aria-label":`${e}: ${p(`market.reset`)}`,onClick:()=>r(``),className:`mr-1 flex size-6 items-center justify-center rounded-full text-ink-3 hover:bg-card hover:text-ink`,children:(0,K.jsx)(v,{className:`size-3.5`})}):null]}),i?(0,K.jsx)(`div`,{role:`listbox`,"aria-label":e,className:`absolute top-full left-0 z-30 mt-1.5 max-h-80 min-w-60 overflow-y-auto rounded-xl bg-card p-1.5 shadow-overlay ring-1 ring-border-soft`,children:n.map(e=>(0,K.jsxs)(`button`,{type:`button`,role:`option`,"aria-selected":e.value===t,disabled:!e.count||e.unavailable,onClick:()=>{r(e.value===t?``:e.value),a(!1)},className:O(`flex w-full items-center gap-2.5 rounded-lg px-2.5 py-2 text-left text-[0.875rem] transition coarse:py-2.5`,e.count&&!e.unavailable?`text-ink-2 hover:bg-paper-2 hover:text-ink`:`text-ink-4`,e.value===t&&`font-medium text-ink`),children:[e.icon,(0,K.jsx)(`span`,{className:`flex-1 whitespace-nowrap`,children:e.label}),e.value===t?(0,K.jsx)(_,{className:`size-4 text-ember`}):e.unavailable?(0,K.jsx)(`span`,{className:`whitespace-nowrap text-[0.75rem] text-ink-4`,children:p(`market.unavailable`)}):(0,K.jsx)(`span`,{className:`text-[0.75rem] text-ink-4 tabular-nums`,children:e.count})]},e.value))}):null]})}function vt(e,t){let[n,r]=(0,G.useState)(e);return(0,G.useEffect)(()=>{let n=setTimeout(()=>r(e),t);return()=>clearTimeout(n)},[e,t]),n}var yt=60;function bt({query:e,onUse:t,busy:n,limit:r=6}){let[i,a]=(0,G.useState)(null),o=vt(e.trim(),250),c=s({queryKey:[`marketplace`,D,o,`hits`,r],queryFn:()=>b.get(`/api/studio/marketplace?${new URLSearchParams({lang:D,limit:String(r),offset:`0`,q:o})}`),enabled:!!o,placeholderData:l}),u=o?c.data?.entries??[]:[];return u.length?(0,K.jsxs)(`section`,{className:`mt-10`,children:[(0,K.jsxs)(`h2`,{className:`mb-5 flex items-center gap-2 font-medium text-[0.8125rem] text-ink-3 uppercase tracking-[0.08em]`,children:[p(`market.hits`),c.isFetching?(0,K.jsx)(w,{className:`size-3.5`}):null]}),(0,K.jsx)(`div`,{className:`grid gap-4 sm:grid-cols-2 lg:grid-cols-3`,children:u.map(e=>(0,K.jsx)(ut,{entry:e,onOpen:()=>a(e.id)},e.id))}),(0,K.jsx)(gt,{id:i,fallback:u.find(e=>e.id===i)??null,onClose:()=>a(null),onUse:t,busy:n})]}):null}function xt({onUse:e,busy:t,open:n}){let[r,i]=(0,G.useState)(``),[a,o]=(0,G.useState)(rt),[s,c]=(0,G.useState)(!1),[u,d]=(0,G.useState)(n??null),f=vt(r.trim(),250),m=le({queryKey:[`marketplace`,D,f,a,s],queryFn:({pageParam:e})=>{let t=new URLSearchParams({lang:D,limit:String(yt),offset:String(e)});f&&t.set(`q`,f);for(let[e,n]of Object.entries(a))n&&t.set(e,n);return s&&t.set(`starred`,`1`),b.get(`/api/studio/marketplace?${t}`)},initialPageParam:0,getNextPageParam:(e,t)=>{let n=t.reduce((e,t)=>e+t.entries.length,0);return n<e.total?n:void 0},placeholderData:l}),h=m.data?.pages[0],g=m.data?.pages.flatMap(e=>e.entries)??[],_=h?.all??0,ee=r.trim()!==f||m.isFetching&&!m.isFetchingNextPage,y=(e,t,n)=>Object.keys(t).filter(t=>h?.facets[e]?.[t]!==void 0).map(r=>({value:r,label:q(t,r),icon:n?.(r),count:(h?.facets[e])[r]??0,unavailable:e===`capability`&&te.has(r)})),te=new Set(h?.unavailable??[]),x=y(`useCase`,qe),ne=[{key:`industry`,name:p(`market.industry`),options:y(`industry`,Ke)},{key:`format`,name:p(`market.format`),options:y(`format`,H,e=>(0,K.jsx)(J,{format:e,className:`size-4 text-ink-3`}))},{key:`plan`,name:p(`market.plan`),options:y(`plan`,Ye)},{key:`capability`,name:p(`market.capability`),options:y(`capability`,U,e=>{let t=dt[e];return(0,K.jsx)(t,{className:`size-4 text-ink-3`})})}],S=!!r.trim()||s||Object.values(a).some(Boolean),C=()=>{o(rt),i(``),c(!1)};if(m.isLoading)return(0,K.jsx)(`div`,{className:`flex justify-center py-10`,children:(0,K.jsx)(w,{className:`size-6 text-ink-3`})});let T=h?.offline?(0,K.jsxs)(`p`,{className:`mt-4 flex items-center justify-center gap-2 text-[0.8125rem] text-ink-3`,children:[(0,K.jsx)(P,{className:`size-4 shrink-0`}),p(`market.offline`)]}):null;if(!_&&!S)return T;let re=r?(0,K.jsx)(`button`,{type:`button`,"aria-label":p(`market.reset`),onClick:()=>i(``),className:`-mr-1.5 flex size-7 shrink-0 items-center justify-center rounded-full text-ink-3 hover:bg-paper-2 hover:text-ink`,children:(0,K.jsx)(v,{className:`size-4`})}):null,k=e=>O(`inline-flex h-7 shrink-0 items-center gap-1 whitespace-nowrap rounded-full px-2.5 text-[0.78125rem] transition`,e?`bg-card font-medium text-ink shadow-soft ring-1 ring-border-soft`:`text-ink-3 hover:bg-card/60 hover:text-ink`);return(0,K.jsxs)(`div`,{children:[(0,K.jsxs)(`label`,{className:`relative mx-auto flex h-10 max-w-md items-center gap-2.5 rounded-full bg-card px-4 shadow-soft ring-1 ring-border-soft transition focus-within:ring-2 focus-within:ring-focus sm:h-11`,children:[ee?(0,K.jsx)(w,{className:`size-4 shrink-0 text-ink-3`}):(0,K.jsx)(Le,{className:`size-4 shrink-0 text-ink-3`}),(0,K.jsx)(`input`,{type:`search`,value:r,onChange:e=>i(e.target.value),placeholder:p(`market.search`),"aria-label":p(`market.search`),className:`min-w-0 flex-1 bg-transparent text-[0.9375rem] outline-none placeholder:text-ink-4 [&::-webkit-search-cancel-button]:hidden`}),re]}),T,(0,K.jsxs)(`div`,{className:`max-sm:-mx-3 mt-4 flex gap-1 max-sm:overflow-x-auto max-sm:px-3 max-sm:[scrollbar-width:none] sm:flex-wrap sm:justify-center max-sm:[&::-webkit-scrollbar]:hidden`,children:[[{value:``,label:p(`market.all`)},...x].map(e=>(0,K.jsx)(`button`,{type:`button`,"aria-pressed":!s&&a.useCase===e.value,onClick:()=>{c(!1),o({...a,useCase:e.value})},className:k(!s&&a.useCase===e.value),children:e.label},e.value)),(0,K.jsxs)(`button`,{type:`button`,"aria-pressed":s,onClick:()=>c(!s),className:k(s),children:[(0,K.jsx)(B,{className:O(`size-3.5`,s&&`fill-amber text-amber`)}),p(`market.starred`)]})]}),(0,K.jsxs)(`div`,{className:`mt-3 flex flex-wrap items-center gap-x-1 gap-y-2 sm:mt-6`,children:[s?null:ne.map(e=>(0,K.jsx)(_t,{name:e.name,value:a[e.key],options:e.options,onChange:t=>o({...a,[e.key]:t})},e.key)),(0,K.jsxs)(`span`,{className:`ml-auto flex items-center gap-3 whitespace-nowrap pl-2 text-[0.8125rem] text-ink-3`,children:[S?(0,K.jsxs)(`button`,{type:`button`,onClick:C,className:`inline-flex items-center gap-1 text-ember-strong underline-offset-2 hover:underline`,children:[(0,K.jsx)(v,{className:`size-3.5 max-sm:size-4`}),(0,K.jsx)(`span`,{className:`max-sm:sr-only`,children:p(`market.resetShort`)})]}):null,S?(0,K.jsx)(`span`,{className:`tabular-nums sm:hidden`,children:p(`market.countOfShort`,{n:h?.total??0,all:_})}):null,(0,K.jsx)(`span`,{className:O(`tabular-nums`,S&&`max-sm:hidden`),children:S?p(`market.countOf`,{n:h?.total??0,all:_}):p(`market.count`,{n:_})})]})]}),g.length?(0,K.jsx)(`div`,{className:`mt-4 grid gap-4 sm:grid-cols-2 lg:grid-cols-3`,children:g.map(e=>(0,K.jsx)(ut,{entry:e,onOpen:()=>d(e.id)},e.id))}):(0,K.jsxs)(`div`,{className:`py-10 text-center text-[0.875rem] text-ink-3`,children:[(0,K.jsx)(`p`,{children:p(s?`market.noneStarred`:`market.none`)}),(0,K.jsx)(E,{variant:`ghost`,className:`mt-2`,onClick:C,children:p(`market.reset`)})]}),m.hasNextPage?(0,K.jsx)(`div`,{className:`mt-6 flex justify-center`,children:(0,K.jsx)(E,{variant:`secondary`,busy:m.isFetchingNextPage,onClick:()=>void m.fetchNextPage(),children:p(`market.more`)})}):null,(0,K.jsx)(gt,{id:u,fallback:g.find(e=>e.id===u)??null,onClose:()=>d(null),onUse:e,busy:t})]})}export{M as C,P as S,A as T,ke as _,tt as a,I as b,U as c,Be as d,B as f,R as g,Me as h,Xe as i,V as l,Ne as m,bt as n,et as o,Le as p,Ze as r,Qe as s,xt as t,We as u,L as v,j as w,ye as x,we as y};
1
+ const __vite__mapDeps=(i,m=__vite__mapDeps,d=(m.f||(m.f=["assets/FlowPreview-COK6Z3jV.js","assets/rolldown-runtime-hePW80VL.js","assets/jsx-runtime-BNakU3Ej.js","assets/ui-SKtUMhUq.js","assets/preload-helper-CNEI7N0N.js","assets/esm-C0TPPvNu.js","assets/index-CsKV2ZNO.js","assets/logo-C4V2_3Ar.js","assets/engenty-eXZ-EAwd.js","assets/useMutation-DKyQXgyj.js","assets/brand-ClxXyg-d.js","assets/volume-2-BX_wS3Lh.js","assets/session-DEXxyxEc.js","assets/index-BBpolc_L.css"])))=>i.map(i=>d[i]);
2
+ import{r as e}from"./rolldown-runtime-hePW80VL.js";import{n as t,t as n}from"./jsx-runtime-BNakU3Ej.js";import{O as r,a as i,c as a,i as o,r as s,s as c,v as l}from"./logo-C4V2_3Ar.js";import{t as u}from"./useMutation-DKyQXgyj.js";import{t as d}from"./preload-helper-CNEI7N0N.js";import{$t as f,Ct as p,Et as m,It as h,Jt as g,Qt as _,Rt as ee,Tt as v,Ut as y,Zt as te,a as b,at as x,fn as ne,in as S,it as C,mt as w,ot as T,rt as E,xt as D,yt as O,zt as re}from"./ui-SKtUMhUq.js";import{l as k,r as ie}from"./brand-ClxXyg-d.js";import{t as ae}from"./volume-2-BX_wS3Lh.js";import{l as oe,u as se}from"./engenty-eXZ-EAwd.js";var ce=class extends i{constructor(e,t){super(e,t)}bindMethods(){super.bindMethods(),this.fetchNextPage=this.fetchNextPage.bind(this),this.fetchPreviousPage=this.fetchPreviousPage.bind(this)}setOptions(e){e._type=`infinite`,super.setOptions(e)}getOptimisticResult(e){return e._type=`infinite`,super.getOptimisticResult(e)}fetchNextPage(e){return this.fetch({...e,meta:{fetchMore:{direction:`forward`}}})}fetchPreviousPage(e){return this.fetch({...e,meta:{fetchMore:{direction:`backward`}}})}createResult(e,t){let{state:n}=e,r=super.createResult(e,t),{isFetching:i,isRefetching:o,isError:s,isRefetchError:l}=r,u=n.fetchMeta?.fetchMore?.direction,d=s&&u===`forward`,f=i&&u===`forward`,p=s&&u===`backward`,m=i&&u===`backward`;return{...r,fetchNextPage:this.fetchNextPage,fetchPreviousPage:this.fetchPreviousPage,hasNextPage:c(t,n.data),hasPreviousPage:a(t,n.data),isFetchNextPageError:d,isFetchingNextPage:f,isFetchPreviousPageError:p,isFetchingPreviousPage:m,isRefetchError:l&&!d&&!p,isRefetching:o&&!f&&!m}}};function le(e,t){return o(e,ce,t)}var ue={name:`app-window`,size:24,node:[[`rect`,{x:`2`,y:`4`,width:`20`,height:`16`,rx:`2`,key:`izxlao`}],[`path`,{d:`M10 4v4`,key:`pp8u80`}],[`path`,{d:`M2 8h20`,key:`d11cs7`}],[`path`,{d:`M6 4v4`,key:`1svtjw`}]]};ue.node;var A=S(ue),de={name:`bot`,size:24,node:[[`path`,{d:`M12 8V4H8`,key:`hb8ula`}],[`rect`,{width:`16`,height:`12`,x:`4`,y:`8`,rx:`2`,key:`enze0r`}],[`path`,{d:`M2 14h2`,key:`vft8re`}],[`path`,{d:`M20 14h2`,key:`4cs60a`}],[`path`,{d:`M15 13v2`,key:`1xurst`}],[`path`,{d:`M9 13v2`,key:`rq6x2g`}]]};de.node;var j=S(de),fe={name:`chart-column`,size:24,node:[[`path`,{d:`M3 3v16a2 2 0 0 0 2 2h16`,key:`c24i48`}],[`path`,{d:`M18 17V9`,key:`2bz60n`}],[`path`,{d:`M13 17V5`,key:`1frdt8`}],[`path`,{d:`M8 17v-3`,key:`17ska0`}]],aliases:[`bar-chart-3`]};fe.node;var pe=S(fe),me={name:`circle-dollar-sign`,size:24,node:[[`circle`,{cx:`12`,cy:`12`,r:`10`,key:`1mglay`}],[`path`,{d:`M16 8h-6a2 2 0 1 0 0 4h4a2 2 0 1 1 0 4H8`,key:`1h4pet`}],[`path`,{d:`M12 18V6`,key:`zqpxq5`}]]};me.node;var he=S(me),ge={name:`circle-euro`,size:24,node:[[`path`,{d:`M15 9.4a4 4 0 1 0 0 5.2`,key:`1makmb`}],[`path`,{d:`M7 12h5`,key:`gblrwe`}],[`circle`,{cx:`12`,cy:`12`,r:`10`,key:`1mglay`}]]};ge.node;var _e=S(ge),ve={name:`clapperboard`,size:24,node:[[`path`,{d:`m12.296 3.464 3.02 3.956`,key:`qash78`}],[`path`,{d:`M20.2 6 3 11l-.9-2.4c-.3-1.1.3-2.2 1.3-2.5l13.5-4c1.1-.3 2.2.3 2.5 1.3z`,key:`1h7j8b`}],[`path`,{d:`M3 11h18v8a2 2 0 0 1-2 2H5a2 2 0 0 1-2-2z`,key:`4lm6w1`}],[`path`,{d:`m6.18 5.276 3.1 3.899`,key:`zjj9t3`}]]};ve.node;var M=S(ve),N={name:`cloud-off`,size:24,node:[[`path`,{d:`M10.94 5.274A7 7 0 0 1 15.71 10h1.79a4.5 4.5 0 0 1 4.222 6.057`,key:`1uxyv8`}],[`path`,{d:`M18.796 18.81A4.5 4.5 0 0 1 17.5 19H9A7 7 0 0 1 5.79 5.78`,key:`99tcn7`}],[`path`,{d:`m2 2 20 20`,key:`1ooewy`}]]};N.node;var P=S(N),F={name:`coins`,size:24,node:[[`path`,{d:`M13.744 17.736a6 6 0 1 1-7.48-7.48`,key:`bq4yh3`}],[`path`,{d:`M15 6h1v4`,key:`11y1tn`}],[`path`,{d:`m6.134 14.768.866-.5 2 3.464`,key:`17snzx`}],[`circle`,{cx:`16`,cy:`8`,r:`6`,key:`14bfc9`}]]};F.node;var ye=S(F),be={name:`eye`,size:24,node:[[`path`,{d:`M2.062 12.348a1 1 0 0 1 0-.696 10.75 10.75 0 0 1 19.876 0 1 1 0 0 1 0 .696 10.75 10.75 0 0 1-19.876 0`,key:`1nclc0`}],[`circle`,{cx:`12`,cy:`12`,r:`3`,key:`1v7zrd`}]]};be.node;var I=S(be),xe={name:`flag`,size:24,node:[[`path`,{d:`M4 22V4a1 1 0 0 1 .4-.8A6 6 0 0 1 8 2c3 0 5 2 7.333 2q2 0 3.067-.8A1 1 0 0 1 20 4v10a1 1 0 0 1-.4.8A6 6 0 0 1 16 16c-3 0-5-2-8-2a6 6 0 0 0-4 1.528`,key:`1jaruq`}]]};xe.node;var Se=S(xe),Ce={name:`globe`,size:24,node:[[`circle`,{cx:`12`,cy:`12`,r:`10`,key:`1mglay`}],[`path`,{d:`M12 2a14.5 14.5 0 0 0 0 20 14.5 14.5 0 0 0 0-20`,key:`13o1zl`}],[`path`,{d:`M2 12h20`,key:`9i4pu4`}]]};Ce.node;var we=S(Ce),Te={name:`image`,size:24,node:[[`rect`,{width:`18`,height:`18`,x:`3`,y:`3`,rx:`2`,ry:`2`,key:`1m3agn`}],[`circle`,{cx:`9`,cy:`9`,r:`2`,key:`af1f0g`}],[`path`,{d:`m21 15-3.086-3.086a2 2 0 0 0-2.828 0L6 21`,key:`1xmnt7`}]]};Te.node;var L=S(Te),Ee={name:`layout-dashboard`,size:24,node:[[`rect`,{width:`7`,height:`9`,x:`3`,y:`3`,rx:`1`,key:`10lvy0`}],[`rect`,{width:`7`,height:`5`,x:`14`,y:`3`,rx:`1`,key:`16une8`}],[`rect`,{width:`7`,height:`9`,x:`14`,y:`12`,rx:`1`,key:`1hutg5`}],[`rect`,{width:`7`,height:`5`,x:`3`,y:`16`,rx:`1`,key:`ldoo1y`}]]};Ee.node;var De=S(Ee),Oe={name:`layout-template`,size:24,node:[[`rect`,{width:`18`,height:`7`,x:`3`,y:`3`,rx:`1`,key:`f1a2em`}],[`rect`,{width:`9`,height:`7`,x:`3`,y:`14`,rx:`1`,key:`jqznyg`}],[`rect`,{width:`5`,height:`7`,x:`16`,y:`14`,rx:`1`,key:`q5h2i8`}]]};Oe.node;var ke=S(Oe),Ae={name:`list-checks`,size:24,node:[[`path`,{d:`M13 5h8`,key:`a7qcls`}],[`path`,{d:`M13 12h8`,key:`h98zly`}],[`path`,{d:`M13 19h8`,key:`c3s6r1`}],[`path`,{d:`m3 17 2 2 4-4`,key:`1jhpwq`}],[`path`,{d:`m3 7 2 2 4-4`,key:`1obspn`}]]};Ae.node;var R=S(Ae),je={name:`plug`,size:24,node:[[`path`,{d:`M12 22v-5`,key:`1ega77`}],[`path`,{d:`M15 8V2`,key:`18g5xt`}],[`path`,{d:`M17 8a1 1 0 0 1 1 1v4a4 4 0 0 1-4 4h-4a4 4 0 0 1-4-4V9a1 1 0 0 1 1-1z`,key:`1xoxul`}],[`path`,{d:`M9 8V2`,key:`14iosj`}]]};je.node;var Me=S(je),z={name:`puzzle`,size:24,node:[[`path`,{d:`M15.39 4.39a1 1 0 0 0 1.68-.474 2.5 2.5 0 1 1 3.014 3.015 1 1 0 0 0-.474 1.68l1.683 1.682a2.414 2.414 0 0 1 0 3.414L19.61 15.39a1 1 0 0 1-1.68-.474 2.5 2.5 0 1 0-3.014 3.015 1 1 0 0 1 .474 1.68l-1.683 1.682a2.414 2.414 0 0 1-3.414 0L8.61 19.61a1 1 0 0 0-1.68.474 2.5 2.5 0 1 1-3.014-3.015 1 1 0 0 0 .474-1.68l-1.683-1.682a2.414 2.414 0 0 1 0-3.414L4.39 8.61a1 1 0 0 1 1.68.474 2.5 2.5 0 1 0 3.014-3.015 1 1 0 0 1-.474-1.68l1.683-1.682a2.414 2.414 0 0 1 3.414 0z`,key:`w46dr5`}]]};z.node;var Ne=S(z),Pe={name:`scan-text`,size:24,node:[[`path`,{d:`M3 7V5a2 2 0 0 1 2-2h2`,key:`aa7l1z`}],[`path`,{d:`M17 3h2a2 2 0 0 1 2 2v2`,key:`4qcy5o`}],[`path`,{d:`M21 17v2a2 2 0 0 1-2 2h-2`,key:`6vwrx8`}],[`path`,{d:`M7 21H5a2 2 0 0 1-2-2v-2`,key:`ioqczr`}],[`path`,{d:`M7 8h8`,key:`1jbsf9`}],[`path`,{d:`M7 12h10`,key:`b7w52i`}],[`path`,{d:`M7 16h6`,key:`1vyc9m`}]]};Pe.node;var Fe=S(Pe),Ie={name:`search`,size:24,node:[[`path`,{d:`m21 21-4.34-4.34`,key:`14j7rj`}],[`circle`,{cx:`11`,cy:`11`,r:`8`,key:`4ej97u`}]]};Ie.node;var Le=S(Ie),Re={name:`star`,size:24,node:[[`path`,{d:`M11.525 2.295a.53.53 0 0 1 .95 0l2.31 4.679a2.123 2.123 0 0 0 1.595 1.16l5.166.756a.53.53 0 0 1 .294.904l-3.736 3.638a2.123 2.123 0 0 0-.611 1.878l.882 5.14a.53.53 0 0 1-.771.56l-4.618-2.428a2.122 2.122 0 0 0-1.973 0L6.396 21.01a.53.53 0 0 1-.77-.56l.881-5.139a2.122 2.122 0 0 0-.611-1.879L2.16 9.795a.53.53 0 0 1 .294-.906l5.165-.755a2.122 2.122 0 0 0 1.597-1.16z`,key:`r04s7s`}]]};Re.node;var B=S(Re),ze={name:`table-2`,size:24,node:[[`path`,{d:`M3 9h18`,key:`1pudct`}],[`path`,{d:`M9 3v18`,key:`fh3hqa`}],[`rect`,{x:`3`,y:`3`,width:`18`,height:`18`,rx:`2`,key:`h1oib`}]]};ze.node;var Be=S(ze),Ve={name:`terminal`,size:24,node:[[`path`,{d:`M12 19h8`,key:`baeox8`}],[`path`,{d:`m4 17 6-6-6-6`,key:`1yngyt`}]]};Ve.node;var He=S(Ve),Ue={name:`type`,size:24,node:[[`path`,{d:`M12 4v16`,key:`1654pz`}],[`path`,{d:`M4 7V5a1 1 0 0 1 1-1h14a1 1 0 0 1 1 1v2`,key:`e0r10z`}],[`path`,{d:`M9 20h6`,key:`s66wpe`}]]};Ue.node;var We=S(Ue),Ge={name:`wand-sparkles`,size:24,node:[[`path`,{d:`m21.64 3.64-1.28-1.28a1.21 1.21 0 0 0-1.72 0L2.36 18.64a1.21 1.21 0 0 0 0 1.72l1.28 1.28a1.2 1.2 0 0 0 1.72 0L21.64 5.36a1.2 1.2 0 0 0 0-1.72`,key:`ul74o6`}],[`path`,{d:`m14 7 3 3`,key:`1r5n42`}],[`path`,{d:`M5 6v4`,key:`ilb8ba`}],[`path`,{d:`M19 14v4`,key:`blhpug`}],[`path`,{d:`M10 2v2`,key:`7u0qdc`}],[`path`,{d:`M7 8H3`,key:`zfb6yr`}],[`path`,{d:`M21 16h-4`,key:`1cnmox`}],[`path`,{d:`M11 3H9`,key:`1obp7u`}]],aliases:[`wand-2`]};Ge.node;var V=S(Ge),H={text:{de:`Text`,en:`Text`},document:{de:`Dokument (PDF, Word)`,en:`Document (PDF, Word)`},table:{de:`Tabelle`,en:`Table`},image:{de:`Bild`,en:`Image`},video:{de:`Video`,en:`Video`},audio:{de:`Audio`,en:`Audio`},dashboard:{de:`Dashboard`,en:`Dashboard`}},Ke={any:{de:`Jede Branche`,en:`Any industry`},trades:{de:`Handwerk`,en:`Trades`},gastronomy:{de:`Gastronomie`,en:`Food service`},hospitality:{de:`Hotel & Tourismus`,en:`Hotels & tourism`},realEstate:{de:`Immobilien`,en:`Real estate`},retail:{de:`Handel`,en:`Retail`},health:{de:`Gesundheit`,en:`Health`},professional:{de:`Kanzlei & Beratung`,en:`Professional services`},agency:{de:`Agentur & Marketing`,en:`Agency & marketing`},events:{de:`Veranstaltungen`,en:`Events`},publicSector:{de:`Vereine & Öffentliches`,en:`Associations & public sector`}},qe={marketing:{de:`Marketing & Social Media`,en:`Marketing & social media`},sales:{de:`Angebote & Verkauf`,en:`Offers & sales`},accounting:{de:`Buchhaltung & Belege`,en:`Accounting & receipts`},service:{de:`Kundenservice`,en:`Customer service`},research:{de:`Recherche & Analyse`,en:`Research & analysis`},hr:{de:`Personal & Bewerbungen`,en:`HR & applications`},operations:{de:`Planung & Abläufe`,en:`Planning & operations`},website:{de:`Helfer für die Website`,en:`Website helpers`},visuals:{de:`Bilder & Video`,en:`Images & video`},inquiries:{de:`Anfragen & Termine`,en:`Inquiries & bookings`},advice:{de:`Beratung & Preise`,en:`Advice & pricing`}},U={text:{de:`Text schreiben`,en:`Writes text`},web:{de:`Websuche`,en:`Web search`},browser:{de:`Browser bedienen`,en:`Drives a browser`},documents:{de:`Dokumente & Fotos lesen`,en:`Reads documents & photos`},image:{de:`Bilder erzeugen`,en:`Makes images`},video:{de:`Videos erzeugen`,en:`Makes video`},speech:{de:`Sprachausgabe`,en:`Speech output`},listening:{de:`Sprachnotizen verstehen`,en:`Understands voice notes`},code:{de:`Code ausführen`,en:`Runs code`},connectors:{de:`Verbundene Konten & Systeme`,en:`Connected accounts & systems`},film:{de:`Filme mit Claude Code (auf deinem Abo)`,en:`Films with Claude Code (on your subscription)`}},Je={low:{de:`günstig`,en:`low cost`},medium:{de:`mittel`,en:`medium cost`},high:{de:`teuer`,en:`high cost`}},Ye={free:{de:`Kostenlos`,en:`Free`},pro:{de:`Pro`,en:`Pro`}},W=e=>Object.keys(e);W(H),W(Ke),W(qe),W(U),W(Ye);var G=e(t(),1);function Xe(e){switch(e.type){case`page`:return R;case`agent`:return j;case`generate`:return e.asset===`image`?L:e.asset===`video`?m:e.asset===`dashboard`?De:y;case`widget`:return A;case`surface`:return ke;case`film`:return M;case`review`:return I;case`result`:return Se}return V}var Ze={page:`bg-cobalt-tint text-cobalt`,agent:`bg-ember-tint text-ember-strong`,generate:`bg-amber-tint text-ink-2`,widget:`bg-ember-veil text-ember-strong`,surface:`bg-ember-veil text-ember-strong`,film:`bg-amber-tint text-ink-2`,review:`bg-moss-tint text-moss`,result:`bg-paper-2 text-ink-2`};function Qe(e){return p(`type.${e.type}`)}var $e=[`web_search`,`web_fetch`,`browser`,`sandbox`,`image`,`http`,`pages`];function et(e){return $e.includes(e)?p(`tool.${e}`):e}function tt(e){switch(e.type){case`page`:return e.fields.map(e=>e.label).join(` · `);case`agent`:{let t=e.tools.map(et),n=e.mcp?.length?[`MCP: ${e.mcp.join(`, `)}`]:[];return[...t,...n].join(` · `)||e.instructions.slice(0,90)}case`generate`:{let t=[e.asset];return e.options?.aspectRatio&&t.push(e.options.aspectRatio),e.options?.duration&&t.push(`${e.options.duration}s`),e.options?.resolution&&t.push(e.options.resolution),e.options?.template&&t.push(e.options.template),t.join(` · `)}case`widget`:return[e.entry,Object.keys(e.data).join(`, `)].filter(Boolean).join(` · `);case`surface`:return e.candidates?e.candidates.map(e=>e.id).join(` · `):Object.keys(e.data).join(`, `);case`film`:return[e.format,e.seconds?`${e.seconds}s`:null,e.skills.join(`, `)].filter(Boolean).join(` · `);case`review`:return[e.edit?p(`editor.reviewEditable`):null,e.regenerate?p(`editor.reviewRedo`):null].filter(Boolean).join(` · `);case`result`:return e.deliverables.map(e=>`${e.label??e.from} (${e.formats.join(`, `)})`).join(` · `)}return``}var K=e(n(),1),nt=(0,G.lazy)(()=>d(()=>import(`./FlowPreview-COK6Z3jV.js`),__vite__mapDeps([0,1,2,3,4,5,6,7,8,9,10,11,12,13]))),rt={useCase:``,industry:``,format:``,capability:``,plan:``},q=(e,t)=>e[t]?.[D]??t;function it(e){if(e<1)return 1;let t=10**Math.floor(Math.log10(e));return Math.round(e/t)*t}function at(e){return e.credits?p(`market.credits`,{n:it(e.credits.credits)}):Je[e.costTier][D]}var ot={text:We,document:y,table:Be,image:L,video:m,audio:f,dashboard:pe};function J({format:e,className:t}){let n=ot[e],r=q(H,e);return(0,K.jsx)(`span`,{title:r,className:`inline-flex`,children:(0,K.jsx)(n,{className:t,"aria-label":r,role:`img`})})}var st=[`low`,`medium`,`high`];function Y({entry:e}){let t=st.indexOf(e.costTier)+1,n=D===`de`?_e:he;return(0,K.jsxs)(`span`,{title:at(e),className:`inline-flex items-center gap-1`,children:[(0,K.jsx)(`span`,{"aria-hidden":`true`,className:`inline-flex shrink-0`,children:st.slice(0,t).map((e,t)=>(0,K.jsx)(`span`,{className:O(`rounded-full bg-(--coin-bg,var(--color-card))`,t>0&&`-ml-1.5`),children:(0,K.jsx)(n,{className:`size-4`})},e))}),Je[e.costTier][D]]})}function ct(){return(0,K.jsx)(x,{tone:`ember`,title:p(`market.proHint`),children:p(`market.pro`)})}function lt({plugin:e}){return(0,K.jsx)(x,{icon:(0,K.jsx)(Ne,{className:`size-3.5`}),title:p(`market.fromPlugin`,{name:e.name}),children:e.name})}function ut({entry:e,onOpen:t}){return(0,K.jsxs)(C,{role:`button`,tabIndex:0,onClick:t,onKeyDown:e=>{(e.key===`Enter`||e.key===` `)&&(e.preventDefault(),t())},className:O(`relative flex min-h-[124px] cursor-pointer flex-col gap-5 p-4 text-left transition sm:min-h-[136px] sm:p-5 hover:shadow-elevated focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-focus`,(!e.usable||e.missing.length>0||!!e.needs?.length)&&`opacity-60`),children:[(0,K.jsx)(`span`,{className:`-top-4 pointer-events-none absolute right-4`,children:(0,K.jsx)(ie,{kind:e.avatar,size:68})}),(0,K.jsxs)(`div`,{className:`min-w-0 pr-20`,children:[(0,K.jsxs)(`div`,{className:`flex items-center gap-1.5 font-display font-semibold text-[0.9375rem]`,children:[e.title,e.plan===`pro`?(0,K.jsx)(ct,{}):null,e.starred?(0,K.jsx)(B,{className:`size-3.5 shrink-0 fill-amber text-amber`,"aria-label":p(`market.starred`)}):null]}),(0,K.jsx)(`div`,{className:`mt-0.5 text-[0.8125rem] text-ink-3 leading-snug`,children:e.pitch})]}),(0,K.jsxs)(`div`,{className:`mt-auto flex flex-wrap items-center gap-x-3 gap-y-1.5 text-[0.75rem] text-ink-3`,children:[e.plugin?(0,K.jsx)(lt,{plugin:e.plugin}):null,e.needs?.length?(0,K.jsx)(x,{tone:`warn`,children:p(`market.needsPro`,{list:e.needs.join(`, `)})}):e.usable&&e.missing.length?(0,K.jsx)(x,{tone:`warn`,children:p(`market.missing`,{list:Z(e.missing)})}):e.usable?(0,K.jsxs)(K.Fragment,{children:[(0,K.jsxs)(`span`,{className:`inline-flex items-center gap-1`,children:[(0,K.jsx)(g,{className:`size-3.5`}),` `,p(`market.minutes`,{n:e.effort.minutes})]}),(0,K.jsx)(Y,{entry:e}),e.optional?.length?(0,K.jsx)(x,{title:p(`market.optionalHint`,{list:Z(e.optional)}),children:p(`market.without`,{list:Z(e.optional)})}):null,(0,K.jsx)(`span`,{className:`ml-auto inline-flex items-center gap-1.5`,children:e.formats.map(e=>(0,K.jsx)(J,{format:e,className:`size-4`},e))})]}):(0,K.jsx)(x,{tone:`warn`,children:p(`market.needsUpdate`)})]})]})}function X({title:e,children:t}){return(0,K.jsxs)(`div`,{children:[(0,K.jsx)(`div`,{className:`mb-1.5 font-medium text-[0.75rem] text-ink-3 uppercase tracking-[0.06em]`,children:e}),t]})}var Z=e=>e.map(e=>q(U,e)).join(`, `),dt={text:h,web:we,browser:ee,documents:Fe,image:L,video:m,speech:ae,listening:re,code:He,connectors:Me,film:M};function ft(e){switch(e.type){case`page`:return R;case`agent`:return j;case`generate`:return e.asset===`image`?L:e.asset===`video`?m:e.asset===`voice`?ae:e.asset===`dashboard`?pe:y;case`widget`:return e.video?M:A;case`surface`:return A;case`film`:return M;case`review`:return I;case`result`:return Se}return V}function pt(e){let t=new Set;for(let[n,r]of e.entries())for(let i of r.branches??[]){let r=i.to===`end`?e.length:e.findIndex(e=>e.id===i.to);for(let i=n+1;i<r;i++)t.add(e[i].id)}return t}function mt(e){let t=pt(e);return e.map(e=>({id:e.id,title:e.title,icon:ft(e),tone:Ze[e.type]??`bg-paper-2 text-ink-2`,optional:t.has(e.id),branches:e.branches}))}function Q({title:e,children:t}){return(0,K.jsx)(`span`,{title:e,className:`inline-flex items-center gap-2 border-border border-l px-4 first:border-l-0 first:pl-0`,children:t})}function $({icon:e,children:t,more:n}){return(0,K.jsxs)(`div`,{className:`flex gap-2.5`,children:[(0,K.jsx)(`span`,{className:`mt-0.5 shrink-0`,children:e}),(0,K.jsxs)(`div`,{className:`min-w-0`,children:[(0,K.jsx)(`div`,{className:`text-[0.875rem] text-ink leading-snug`,children:t}),n?(0,K.jsx)(`div`,{className:`text-[0.75rem] text-ink-3 leading-snug`,children:n}):null]})]})}function ht({className:e,children:t}){let n=(0,G.useRef)(null),[r,i]=(0,G.useState)({above:!1,below:!1});(0,G.useEffect)(()=>{let e=n.current;if(!e)return;let t=()=>{let t=e.scrollTop>1,n=e.scrollTop+e.clientHeight<e.scrollHeight-1;i(e=>e.above===t&&e.below===n?e:{above:t,below:n})};t(),e.addEventListener(`scroll`,t,{passive:!0});let r=new ResizeObserver(t);return r.observe(e),e.firstElementChild&&r.observe(e.firstElementChild),()=>{e.removeEventListener(`scroll`,t),r.disconnect()}},[]);let a=`linear-gradient(to bottom, ${r.above?`transparent`:`black`} 0, black 28px, black calc(100% - 44px), ${r.below?`transparent`:`black`} 100%)`;return(0,K.jsx)(`div`,{ref:n,className:e,style:{maskImage:a,WebkitMaskImage:a},children:(0,K.jsx)(`div`,{children:t})})}function gt({id:e,fallback:t,onClose:n,onUse:i,busy:a}){let o=r(),c=ne(),l=s({queryKey:[`marketplace-entry`,e,D],queryFn:()=>b.get(`/api/studio/marketplace/${encodeURIComponent(e)}?lang=${D}`),enabled:!!e,retry:!1}),d=l.data??t,f=u({mutationFn:t=>{let n=`/api/studio/marketplace/${encodeURIComponent(e)}/star`;return t?b.put(n):b.del(n)},onSuccess:()=>Promise.all([o.invalidateQueries({queryKey:[`marketplace`]}),o.invalidateQueries({queryKey:[`marketplace-entry`,e]})])}),m=k()===`dark`,h=oe[se[d?.avatar||`round`]],_=m?`var(--card)`:`color-mix(in oklch, ${h??`var(--ink-4)`} 14%, var(--paper-2))`;return(0,K.jsx)(T,{open:!!e,onClose:n,wide:!0,bare:!0,children:d?(0,K.jsxs)(`div`,{className:`relative flex max-h-[calc(100dvh-48px)] flex-col rounded-2xl bg-card shadow-overlay max-sm:h-dvh max-sm:max-h-none max-sm:rounded-none`,children:[(0,K.jsx)(`button`,{type:`button`,"aria-label":p(`common.close`),onClick:n,className:`sm:-top-3.5 sm:-right-3.5 absolute top-3 right-3 z-20 flex size-9 items-center justify-center rounded-full bg-card text-ink-2 shadow-elevated ring-1 ring-border-soft transition hover:text-ink focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-focus`,children:(0,K.jsx)(v,{className:`size-4`})}),(0,K.jsxs)(`header`,{className:`relative shrink-0 border-border-soft border-b px-5 pt-5 pb-4 text-ink sm:rounded-t-2xl sm:px-7`,style:{background:_,"--coin-bg":_},children:[(0,K.jsx)(`span`,{"aria-hidden":`true`,className:`pointer-events-none absolute inset-0 overflow-hidden sm:rounded-t-2xl`,children:(0,K.jsx)(`span`,{className:O(`-top-28 -right-10 absolute size-80 rounded-full bg-white blur-3xl`,m?`opacity-[0.14]`:`opacity-80`)})}),(0,K.jsx)(`div`,{className:`-bottom-5 absolute right-9 z-10 max-sm:hidden`,children:(0,K.jsx)(ie,{kind:d.avatar,size:104})}),(0,K.jsxs)(`div`,{className:`relative sm:pr-36`,children:[(0,K.jsx)(`h2`,{className:`font-display font-semibold text-[1.375rem] leading-tight tracking-tight max-sm:pr-10`,children:d.title}),(0,K.jsx)(`p`,{className:`mt-1 text-[0.875rem] text-ink-2 leading-snug`,children:l.data?.description||d.pitch})]}),d.usable?(0,K.jsxs)(`div`,{className:`-mx-5 sm:-mx-7 relative mt-3.5 flex flex-wrap items-center gap-y-2 border-border-soft border-t px-5 pt-3 font-medium text-[0.875rem] sm:px-7 sm:pr-40`,children:[(0,K.jsxs)(Q,{title:p(`market.duration`),children:[(0,K.jsx)(g,{className:`size-4 text-ink-3`}),p(`market.minutes`,{n:d.effort.minutes})]}),(0,K.jsx)(Q,{title:p(`market.cost`),children:(0,K.jsx)(Y,{entry:d})}),(0,K.jsx)(Q,{title:p(`market.result`),children:d.formats.map(e=>(0,K.jsx)(J,{format:e,className:`size-4`},e))})]}):null]}),d.usable?(0,K.jsxs)(`div`,{className:`grid min-h-0 flex-1 gap-x-7 gap-y-6 px-5 pt-6 max-sm:overflow-y-auto max-sm:pb-4 sm:grid-cols-[230px_minmax(0,1fr)] sm:grid-rows-[minmax(0,1fr)] sm:px-7`,children:[(0,K.jsxs)(`div`,{className:`flex flex-col gap-5 sm:min-h-0 sm:overflow-y-auto`,children:[(0,K.jsx)(X,{title:p(`market.duration`),children:(0,K.jsx)($,{icon:(0,K.jsx)(g,{className:`size-4 text-moss`}),more:p(`market.durationHint`,{n:d.effort.fields}),children:p(`market.minutes`,{n:d.effort.minutes})})}),(0,K.jsx)(X,{title:p(`market.cost`),children:(0,K.jsx)($,{icon:(0,K.jsx)(ye,{className:`size-4 text-amber`}),more:d.credits?p(`market.creditsHint`):void 0,children:(0,K.jsxs)(`span`,{className:`flex flex-wrap items-center gap-x-2`,children:[(0,K.jsx)(Y,{entry:d}),d.credits?(0,K.jsx)(`span`,{className:`text-ink-2`,children:p(`market.creditsRange`,{n:it(d.credits.credits)})}):null]})})}),(0,K.jsx)(X,{title:p(`market.result`),children:(0,K.jsx)(`div`,{className:`flex flex-col gap-2`,children:(l.data?.results??[]).map(e=>(0,K.jsx)($,{icon:(0,K.jsx)(J,{format:e.kind,className:`size-4 text-ember-strong`}),more:e.formats.map(e=>e.toUpperCase()).join(` · `),children:e.title},e.title))})}),(0,K.jsx)(X,{title:p(`market.needs`),children:(0,K.jsx)(`ul`,{className:`flex flex-col gap-2`,children:d.capabilities.map(e=>{let t=dt[e],n=d.missing.includes(e),r=d.optional?.includes(e);return(0,K.jsxs)(`li`,{className:O(`flex items-center gap-2.5 text-[0.875rem]`,n?`text-ink-3`:`text-ink-2`),children:[(0,K.jsx)(t,{className:O(`size-4 shrink-0`,n?`text-rose`:r?`text-amber`:`text-cobalt`)}),q(U,e),n?(0,K.jsx)(`span`,{className:`text-[0.75rem] text-rose`,children:p(`market.unavailable`)}):r?(0,K.jsx)(`span`,{className:`text-[0.75rem] text-amber`,children:p(`market.optional`)}):null]},e)})})})]}),(0,K.jsxs)(`div`,{className:`flex flex-col sm:min-h-0`,children:[(0,K.jsx)(`div`,{className:`mb-1.5 shrink-0 font-medium text-[0.75rem] text-ink-3 uppercase tracking-[0.06em]`,children:p(`market.steps`)}),(0,K.jsx)(ht,{className:`-mr-2 overscroll-contain pt-1 pr-2 pl-1 sm:min-h-0 sm:flex-1 sm:overflow-y-auto`,children:l.isLoading?(0,K.jsx)(w,{className:`size-5 text-ink-3`}):(0,K.jsx)(G.Suspense,{fallback:(0,K.jsx)(w,{className:`size-5 text-ink-3`}),children:(0,K.jsx)(nt,{steps:mt(l.data?.outline??[])})})})]})]}):(0,K.jsx)(`div`,{className:`flex-1 px-5 pt-6 sm:px-7`,children:(0,K.jsx)(`p`,{className:`rounded-lg bg-amber-tint p-3 text-[0.875rem] text-ink-2`,children:p(`market.needsUpdateHint`)})}),(0,K.jsxs)(`div`,{className:`flex shrink-0 justify-end gap-2 px-5 pt-4 pb-5 max-sm:border-border-soft max-sm:border-t sm:px-7 sm:pb-6`,children:[d.plugin?(0,K.jsx)(`span`,{className:`mr-auto flex items-center`,children:(0,K.jsx)(lt,{plugin:d.plugin})}):(0,K.jsxs)(E,{variant:`ghost`,className:`mr-auto`,title:p(`market.starHint`),"aria-pressed":d.starred,busy:f.isPending,onClick:()=>f.mutate(!d.starred),children:[(0,K.jsx)(B,{className:O(`size-4`,d.starred&&`fill-amber text-amber`)}),(0,K.jsx)(`span`,{className:`max-sm:sr-only`,children:p(d.starred?`market.starred`:`market.star`)})]}),(0,K.jsx)(E,{variant:`secondary`,onClick:n,children:p(`common.close`)}),d.usable&&d.missing.length?(0,K.jsx)(E,{variant:`secondary`,onClick:()=>c(`/settings/models`),children:p(`editor.models.settings`)}):null,i?(0,K.jsx)(E,{disabled:!d.usable||d.missing.length>0||!!d.needs?.length,title:d.needs?.length?p(`market.needsProHint`,{list:d.needs.join(`, `)}):d.missing.length?p(`market.missingHint`,{list:Z(d.missing)}):d.optional?.length?p(`market.optionalHint`,{list:Z(d.optional)}):void 0,busy:a,onClick:()=>i(d),children:p(`market.use`)}):null]})]}):(0,K.jsx)(`div`,{className:`flex min-h-48 flex-col items-center justify-center gap-3 rounded-2xl bg-card p-8 text-[0.875rem] text-ink-2 shadow-overlay`,children:l.isLoading?(0,K.jsx)(w,{className:`size-6 text-ink-3`}):(0,K.jsxs)(K.Fragment,{children:[(0,K.jsx)(`p`,{children:p(`market.notFound`)}),(0,K.jsx)(E,{variant:`secondary`,onClick:n,children:p(`common.close`)})]})})})}function _t({name:e,value:t,options:n,onChange:r}){let[i,a]=(0,G.useState)(!1),o=(0,G.useRef)(null);(0,G.useEffect)(()=>{if(!i)return;let e=e=>{o.current?.contains(e.target)||a(!1)},t=e=>{e.key===`Escape`&&a(!1)};return document.addEventListener(`mousedown`,e),document.addEventListener(`keydown`,t),()=>{document.removeEventListener(`mousedown`,e),document.removeEventListener(`keydown`,t)}},[i]);let s=n.find(e=>e.value===t);return(0,K.jsxs)(`div`,{ref:o,className:`relative`,children:[(0,K.jsxs)(`div`,{className:O(`flex h-8 items-center rounded-full text-[0.8125rem] transition`,s?`bg-ember-tint text-ink`:`text-ink-2 hover:bg-paper-2 hover:text-ink`,i&&!s&&`bg-paper-2 text-ink`),children:[(0,K.jsx)(`button`,{type:`button`,"aria-haspopup":`listbox`,"aria-expanded":i,onClick:()=>a(!i),className:O(`flex h-full items-center gap-1.5 rounded-full pl-3 focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-focus`,s?`pr-1`:`pr-2.5`),children:s?(0,K.jsxs)(K.Fragment,{children:[(0,K.jsx)(`span`,{className:`text-ink-3`,children:e}),(0,K.jsx)(`span`,{className:`font-medium`,children:s.label})]}):(0,K.jsxs)(K.Fragment,{children:[e,(0,K.jsx)(te,{className:O(`size-3.5 transition`,i&&`rotate-180`)})]})}),s?(0,K.jsx)(`button`,{type:`button`,"aria-label":`${e}: ${p(`market.reset`)}`,onClick:()=>r(``),className:`mr-1 flex size-6 items-center justify-center rounded-full text-ink-3 hover:bg-card hover:text-ink`,children:(0,K.jsx)(v,{className:`size-3.5`})}):null]}),i?(0,K.jsx)(`div`,{role:`listbox`,"aria-label":e,className:`absolute top-full left-0 z-30 mt-1.5 max-h-80 min-w-60 overflow-y-auto rounded-xl bg-card p-1.5 shadow-overlay ring-1 ring-border-soft`,children:n.map(e=>(0,K.jsxs)(`button`,{type:`button`,role:`option`,"aria-selected":e.value===t,disabled:!e.count||e.unavailable,onClick:()=>{r(e.value===t?``:e.value),a(!1)},className:O(`flex w-full items-center gap-2.5 rounded-lg px-2.5 py-2 text-left text-[0.875rem] transition coarse:py-2.5`,e.count&&!e.unavailable?`text-ink-2 hover:bg-paper-2 hover:text-ink`:`text-ink-4`,e.value===t&&`font-medium text-ink`),children:[e.icon,(0,K.jsx)(`span`,{className:`flex-1 whitespace-nowrap`,children:e.label}),e.value===t?(0,K.jsx)(_,{className:`size-4 text-ember`}):e.unavailable?(0,K.jsx)(`span`,{className:`whitespace-nowrap text-[0.75rem] text-ink-4`,children:p(`market.unavailable`)}):(0,K.jsx)(`span`,{className:`text-[0.75rem] text-ink-4 tabular-nums`,children:e.count})]},e.value))}):null]})}function vt(e,t){let[n,r]=(0,G.useState)(e);return(0,G.useEffect)(()=>{let n=setTimeout(()=>r(e),t);return()=>clearTimeout(n)},[e,t]),n}var yt=60;function bt({query:e,onUse:t,busy:n,limit:r=6}){let[i,a]=(0,G.useState)(null),o=vt(e.trim(),250),c=s({queryKey:[`marketplace`,D,o,`hits`,r],queryFn:()=>b.get(`/api/studio/marketplace?${new URLSearchParams({lang:D,limit:String(r),offset:`0`,q:o})}`),enabled:!!o,placeholderData:l}),u=o?c.data?.entries??[]:[];return u.length?(0,K.jsxs)(`section`,{className:`mt-10`,children:[(0,K.jsxs)(`h2`,{className:`mb-5 flex items-center gap-2 font-medium text-[0.8125rem] text-ink-3 uppercase tracking-[0.08em]`,children:[p(`market.hits`),c.isFetching?(0,K.jsx)(w,{className:`size-3.5`}):null]}),(0,K.jsx)(`div`,{className:`grid gap-4 sm:grid-cols-2 lg:grid-cols-3`,children:u.map(e=>(0,K.jsx)(ut,{entry:e,onOpen:()=>a(e.id)},e.id))}),(0,K.jsx)(gt,{id:i,fallback:u.find(e=>e.id===i)??null,onClose:()=>a(null),onUse:t,busy:n})]}):null}function xt({onUse:e,busy:t,open:n}){let[r,i]=(0,G.useState)(``),[a,o]=(0,G.useState)(rt),[s,c]=(0,G.useState)(!1),[u,d]=(0,G.useState)(n??null),f=vt(r.trim(),250),m=le({queryKey:[`marketplace`,D,f,a,s],queryFn:({pageParam:e})=>{let t=new URLSearchParams({lang:D,limit:String(yt),offset:String(e)});f&&t.set(`q`,f);for(let[e,n]of Object.entries(a))n&&t.set(e,n);return s&&t.set(`starred`,`1`),b.get(`/api/studio/marketplace?${t}`)},initialPageParam:0,getNextPageParam:(e,t)=>{let n=t.reduce((e,t)=>e+t.entries.length,0);return n<e.total?n:void 0},placeholderData:l}),h=m.data?.pages[0],g=m.data?.pages.flatMap(e=>e.entries)??[],_=h?.all??0,ee=r.trim()!==f||m.isFetching&&!m.isFetchingNextPage,y=(e,t,n)=>Object.keys(t).filter(t=>h?.facets[e]?.[t]!==void 0).map(r=>({value:r,label:q(t,r),icon:n?.(r),count:(h?.facets[e])[r]??0,unavailable:e===`capability`&&te.has(r)})),te=new Set(h?.unavailable??[]),x=y(`useCase`,qe),ne=[{key:`industry`,name:p(`market.industry`),options:y(`industry`,Ke)},{key:`format`,name:p(`market.format`),options:y(`format`,H,e=>(0,K.jsx)(J,{format:e,className:`size-4 text-ink-3`}))},{key:`plan`,name:p(`market.plan`),options:y(`plan`,Ye)},{key:`capability`,name:p(`market.capability`),options:y(`capability`,U,e=>{let t=dt[e];return(0,K.jsx)(t,{className:`size-4 text-ink-3`})})}],S=!!r.trim()||s||Object.values(a).some(Boolean),C=()=>{o(rt),i(``),c(!1)};if(m.isLoading)return(0,K.jsx)(`div`,{className:`flex justify-center py-10`,children:(0,K.jsx)(w,{className:`size-6 text-ink-3`})});let T=h?.offline?(0,K.jsxs)(`p`,{className:`mt-4 flex items-center justify-center gap-2 text-[0.8125rem] text-ink-3`,children:[(0,K.jsx)(P,{className:`size-4 shrink-0`}),p(`market.offline`)]}):null;if(!_&&!S)return T;let re=r?(0,K.jsx)(`button`,{type:`button`,"aria-label":p(`market.reset`),onClick:()=>i(``),className:`-mr-1.5 flex size-7 shrink-0 items-center justify-center rounded-full text-ink-3 hover:bg-paper-2 hover:text-ink`,children:(0,K.jsx)(v,{className:`size-4`})}):null,k=e=>O(`inline-flex h-7 shrink-0 items-center gap-1 whitespace-nowrap rounded-full px-2.5 text-[0.78125rem] transition`,e?`bg-card font-medium text-ink shadow-soft ring-1 ring-border-soft`:`text-ink-3 hover:bg-card/60 hover:text-ink`);return(0,K.jsxs)(`div`,{children:[(0,K.jsxs)(`label`,{className:`relative mx-auto flex h-10 max-w-md items-center gap-2.5 rounded-full bg-card px-4 shadow-soft ring-1 ring-border-soft transition focus-within:ring-2 focus-within:ring-focus sm:h-11`,children:[ee?(0,K.jsx)(w,{className:`size-4 shrink-0 text-ink-3`}):(0,K.jsx)(Le,{className:`size-4 shrink-0 text-ink-3`}),(0,K.jsx)(`input`,{type:`search`,value:r,onChange:e=>i(e.target.value),placeholder:p(`market.search`),"aria-label":p(`market.search`),className:`min-w-0 flex-1 bg-transparent text-[0.9375rem] outline-none placeholder:text-ink-4 [&::-webkit-search-cancel-button]:hidden`}),re]}),T,(0,K.jsxs)(`div`,{className:`max-sm:-mx-3 mt-4 flex gap-1 max-sm:overflow-x-auto max-sm:px-3 max-sm:[scrollbar-width:none] sm:flex-wrap sm:justify-center max-sm:[&::-webkit-scrollbar]:hidden`,children:[[{value:``,label:p(`market.all`)},...x].map(e=>(0,K.jsx)(`button`,{type:`button`,"aria-pressed":!s&&a.useCase===e.value,onClick:()=>{c(!1),o({...a,useCase:e.value})},className:k(!s&&a.useCase===e.value),children:e.label},e.value)),(0,K.jsxs)(`button`,{type:`button`,"aria-pressed":s,onClick:()=>c(!s),className:k(s),children:[(0,K.jsx)(B,{className:O(`size-3.5`,s&&`fill-amber text-amber`)}),p(`market.starred`)]})]}),(0,K.jsxs)(`div`,{className:`mt-3 flex flex-wrap items-center gap-x-1 gap-y-2 sm:mt-6`,children:[s?null:ne.map(e=>(0,K.jsx)(_t,{name:e.name,value:a[e.key],options:e.options,onChange:t=>o({...a,[e.key]:t})},e.key)),(0,K.jsxs)(`span`,{className:`ml-auto flex items-center gap-3 whitespace-nowrap pl-2 text-[0.8125rem] text-ink-3`,children:[S?(0,K.jsxs)(`button`,{type:`button`,onClick:C,className:`inline-flex items-center gap-1 text-ember-strong underline-offset-2 hover:underline`,children:[(0,K.jsx)(v,{className:`size-3.5 max-sm:size-4`}),(0,K.jsx)(`span`,{className:`max-sm:sr-only`,children:p(`market.resetShort`)})]}):null,S?(0,K.jsx)(`span`,{className:`tabular-nums sm:hidden`,children:p(`market.countOfShort`,{n:h?.total??0,all:_})}):null,(0,K.jsx)(`span`,{className:O(`tabular-nums`,S&&`max-sm:hidden`),children:S?p(`market.countOf`,{n:h?.total??0,all:_}):p(`market.count`,{n:_})})]})]}),g.length?(0,K.jsx)(`div`,{className:`mt-4 grid gap-4 sm:grid-cols-2 lg:grid-cols-3`,children:g.map(e=>(0,K.jsx)(ut,{entry:e,onOpen:()=>d(e.id)},e.id))}):(0,K.jsxs)(`div`,{className:`py-10 text-center text-[0.875rem] text-ink-3`,children:[(0,K.jsx)(`p`,{children:p(s?`market.noneStarred`:`market.none`)}),(0,K.jsx)(E,{variant:`ghost`,className:`mt-2`,onClick:C,children:p(`market.reset`)})]}),m.hasNextPage?(0,K.jsx)(`div`,{className:`mt-6 flex justify-center`,children:(0,K.jsx)(E,{variant:`secondary`,busy:m.isFetchingNextPage,onClick:()=>void m.fetchNextPage(),children:p(`market.more`)})}):null,(0,K.jsx)(gt,{id:u,fallback:g.find(e=>e.id===u)??null,onClose:()=>d(null),onUse:e,busy:t})]})}export{M as C,P as S,A as T,ke as _,tt as a,I as b,U as c,Be as d,B as f,R as g,Me as h,Xe as i,V as l,Ne as m,bt as n,et as o,Le as p,Ze as r,Qe as s,xt as t,We as u,L as v,j as w,ye as x,we as y};
@@ -1 +1 @@
1
- import{r as e}from"./rolldown-runtime-hePW80VL.js";import{n as t,t as n}from"./jsx-runtime-BNakU3Ej.js";import{O as r}from"./logo-C4V2_3Ar.js";import{t as i}from"./Marketplace-C3xWcJYM.js";import{t as a}from"./useMutation-DKyQXgyj.js";import{Ct as o,a as s,cn as c,fn as l,mn as u,ot as d,rt as f,tn as p,tt as m,vt as h,xt as g}from"./ui-FW7ypPI6.js";import{r as _}from"./brand-DIKyySmf.js";import{t as v}from"./upload-MQ_24gSb.js";import{d as y,s as b}from"./session-CSbo-pmx.js";var x=e(t(),1),S=e(n(),1);function C({variant:e=`secondary`,label:t=o(`home.import`)}){let n=l(),i=r(),{project:c}=b(),u=y(),p=(0,x.useRef)(null),h=a({mutationFn:e=>s.upload(`/api/studio/projects/${c.id}/wizards/import`,e),onSuccess:async({id:e})=>{await i.invalidateQueries({queryKey:[`projects`]}),await i.invalidateQueries({queryKey:[`wizards`]}),n(`/edit/${e}`)}}),g=h.error instanceof m?h.error.body?.issues??[]:[];return!u||c?.readOnly?null:(0,S.jsxs)(S.Fragment,{children:[(0,S.jsxs)(f,{variant:e,busy:h.isPending,disabled:!c,onClick:()=>p.current?.click(),children:[(0,S.jsx)(v,{className:`size-4`}),` `,t]}),(0,S.jsx)(`input`,{ref:p,hidden:!0,type:`file`,onChange:e=>{let t=e.target.files?.[0];e.target.value=``,t&&h.mutate(t)}}),(0,S.jsxs)(d,{open:h.isError,onClose:h.reset,title:o(`import.failed`),children:[(0,S.jsx)(`p`,{className:`text-[0.875rem] text-ink-2`,children:h.error?.message}),g.length?(0,S.jsx)(`ul`,{className:`mt-3 flex list-disc flex-col gap-1 pl-5 text-[0.8125rem] text-ink-2`,children:g.slice(0,8).map(e=>(0,S.jsx)(`li`,{children:e.message},e.message))}):null,(0,S.jsx)(`div`,{className:`mt-5 flex justify-end`,children:(0,S.jsx)(f,{variant:`secondary`,onClick:h.reset,children:o(`common.close`)})})]})]})}var w={de:[`Stellenanzeige aus ein paar Stichworten, als PDF und LinkedIn-Post`,`Produktbeschreibung für den Onlineshop mit drei Bildvarianten`,`Wettbewerbsanalyse zu einer Firma mit Quellen`,`Lead aus einem Formular in unser CRM eintragen`],en:[`A job ad from a few keywords, as PDF and LinkedIn post`,`A shop product description with three image variants`,`A competitor analysis for a company, with sources`,`Put a lead from a form into our CRM`]};function T(){let e=l(),t=r(),{project:n}=b(),d=y(),[m]=u(),[v,T]=(0,x.useState)(m.get(`wish`)??``),E=a({mutationFn:e=>s.post(`/api/studio/wizards`,{projectId:n.id,starterId:e,lang:g}),onSuccess:async({id:n},r)=>{await t.invalidateQueries({queryKey:[`projects`]}),await t.invalidateQueries({queryKey:[`wizards`]}),e(r?`/edit/${n}`:`/edit/${n}?prompt=${encodeURIComponent(v.trim())}`)}}),D=()=>{v.trim()&&n&&E.mutate(void 0)};return!d||n?.readOnly?(0,S.jsx)(c,{to:`/`,replace:!0}):(0,S.jsxs)(`div`,{className:`animate-rise pt-4`,children:[(0,S.jsxs)(`div`,{className:`mx-auto max-w-2xl`,children:[(0,S.jsxs)(`div`,{className:`flex flex-col items-center text-center`,children:[(0,S.jsx)(_,{kind:`sprout`,size:150,fluffy:!0}),(0,S.jsx)(`h1`,{className:`mt-2 font-display font-semibold text-[2rem] leading-tight tracking-tight sm:text-[2.375rem]`,children:o(`new.title`)})]}),(0,S.jsxs)(`div`,{className:`mt-8 rounded-2xl bg-card p-2 shadow-elevated ring-1 ring-border-soft focus-within:ring-focus`,children:[(0,S.jsx)(h,{autoFocus:!0,minRows:4,value:v,onChange:e=>T(e.target.value),onKeyDown:e=>{e.key===`Enter`&&(e.metaKey||e.ctrlKey)&&D()},placeholder:o(`new.placeholder`),className:`border-0 bg-transparent text-[1rem] shadow-none focus:ring-0`}),(0,S.jsxs)(`div`,{className:`flex items-center justify-between gap-3 px-2 pb-1`,children:[(0,S.jsx)(`span`,{className:`hidden text-[0.75rem] text-ink-4 sm:block`,children:o(`new.hint`)}),(0,S.jsxs)(f,{size:`md`,onClick:D,busy:E.isPending&&!E.variables,disabled:!v.trim(),children:[o(`new.build`),` `,(0,S.jsx)(p,{className:`size-4`})]})]})]}),(0,S.jsx)(`div`,{className:`mt-4 flex flex-wrap justify-center gap-2`,children:w[g].map(e=>(0,S.jsx)(`button`,{type:`button`,onClick:()=>T(e),className:`rounded-full bg-paper-2 px-3.5 py-1.5 text-[0.8125rem] text-ink-2 transition hover:bg-paper-3 hover:text-ink`,children:e},e))})]}),(0,S.jsxs)(`section`,{className:`mx-auto max-w-5xl`,children:[(0,S.jsx)(`h2`,{className:`mt-16 mb-5 text-center font-medium text-[0.8125rem] text-ink-3 uppercase tracking-[0.08em]`,children:o(`new.orStarter`)}),(0,S.jsx)(i,{open:m.get(`starter`),busy:E.isPending&&!!E.variables,onUse:e=>n&&!E.isPending&&E.mutate(e.id)}),E.error?(0,S.jsx)(`p`,{className:`mt-3 text-center text-[0.875rem] text-rose`,children:E.error.message}):null]}),(0,S.jsx)(`div`,{className:`mt-8 flex justify-center`,children:(0,S.jsx)(C,{variant:`ghost`,label:o(`new.import`)})})]})}export{T as NewWizardPage};
1
+ import{r as e}from"./rolldown-runtime-hePW80VL.js";import{n as t,t as n}from"./jsx-runtime-BNakU3Ej.js";import{O as r}from"./logo-C4V2_3Ar.js";import{t as i}from"./Marketplace-CmeAQDOY.js";import{t as a}from"./useMutation-DKyQXgyj.js";import{Ct as o,a as s,cn as c,fn as l,mn as u,ot as d,rt as f,tn as p,tt as m,vt as h,xt as g}from"./ui-SKtUMhUq.js";import{r as _}from"./brand-ClxXyg-d.js";import{t as v}from"./upload-hT54Sh8P.js";import{d as y,s as b}from"./session-DEXxyxEc.js";var x=e(t(),1),S=e(n(),1);function C({variant:e=`secondary`,label:t=o(`home.import`)}){let n=l(),i=r(),{project:c}=b(),u=y(),p=(0,x.useRef)(null),h=a({mutationFn:e=>s.upload(`/api/studio/projects/${c.id}/wizards/import`,e),onSuccess:async({id:e})=>{await i.invalidateQueries({queryKey:[`projects`]}),await i.invalidateQueries({queryKey:[`wizards`]}),n(`/edit/${e}`)}}),g=h.error instanceof m?h.error.body?.issues??[]:[];return!u||c?.readOnly?null:(0,S.jsxs)(S.Fragment,{children:[(0,S.jsxs)(f,{variant:e,busy:h.isPending,disabled:!c,onClick:()=>p.current?.click(),children:[(0,S.jsx)(v,{className:`size-4`}),` `,t]}),(0,S.jsx)(`input`,{ref:p,hidden:!0,type:`file`,onChange:e=>{let t=e.target.files?.[0];e.target.value=``,t&&h.mutate(t)}}),(0,S.jsxs)(d,{open:h.isError,onClose:h.reset,title:o(`import.failed`),children:[(0,S.jsx)(`p`,{className:`text-[0.875rem] text-ink-2`,children:h.error?.message}),g.length?(0,S.jsx)(`ul`,{className:`mt-3 flex list-disc flex-col gap-1 pl-5 text-[0.8125rem] text-ink-2`,children:g.slice(0,8).map(e=>(0,S.jsx)(`li`,{children:e.message},e.message))}):null,(0,S.jsx)(`div`,{className:`mt-5 flex justify-end`,children:(0,S.jsx)(f,{variant:`secondary`,onClick:h.reset,children:o(`common.close`)})})]})]})}var w={de:[`Stellenanzeige aus ein paar Stichworten, als PDF und LinkedIn-Post`,`Produktbeschreibung für den Onlineshop mit drei Bildvarianten`,`Wettbewerbsanalyse zu einer Firma mit Quellen`,`Lead aus einem Formular in unser CRM eintragen`],en:[`A job ad from a few keywords, as PDF and LinkedIn post`,`A shop product description with three image variants`,`A competitor analysis for a company, with sources`,`Put a lead from a form into our CRM`]};function T(){let e=l(),t=r(),{project:n}=b(),d=y(),[m]=u(),[v,T]=(0,x.useState)(m.get(`wish`)??``),E=a({mutationFn:e=>s.post(`/api/studio/wizards`,{projectId:n.id,starterId:e,lang:g}),onSuccess:async({id:n},r)=>{await t.invalidateQueries({queryKey:[`projects`]}),await t.invalidateQueries({queryKey:[`wizards`]}),e(r?`/edit/${n}`:`/edit/${n}?prompt=${encodeURIComponent(v.trim())}`)}}),D=()=>{v.trim()&&n&&E.mutate(void 0)};return!d||n?.readOnly?(0,S.jsx)(c,{to:`/`,replace:!0}):(0,S.jsxs)(`div`,{className:`animate-rise pt-4`,children:[(0,S.jsxs)(`div`,{className:`mx-auto max-w-2xl`,children:[(0,S.jsxs)(`div`,{className:`flex flex-col items-center text-center`,children:[(0,S.jsx)(_,{kind:`sprout`,size:150,fluffy:!0}),(0,S.jsx)(`h1`,{className:`mt-2 font-display font-semibold text-[2rem] leading-tight tracking-tight sm:text-[2.375rem]`,children:o(`new.title`)})]}),(0,S.jsxs)(`div`,{className:`mt-8 rounded-2xl bg-card p-2 shadow-elevated ring-1 ring-border-soft focus-within:ring-focus`,children:[(0,S.jsx)(h,{autoFocus:!0,minRows:4,value:v,onChange:e=>T(e.target.value),onKeyDown:e=>{e.key===`Enter`&&(e.metaKey||e.ctrlKey)&&D()},placeholder:o(`new.placeholder`),className:`border-0 bg-transparent text-[1rem] shadow-none focus:ring-0`}),(0,S.jsxs)(`div`,{className:`flex items-center justify-between gap-3 px-2 pb-1`,children:[(0,S.jsx)(`span`,{className:`hidden text-[0.75rem] text-ink-4 sm:block`,children:o(`new.hint`)}),(0,S.jsxs)(f,{size:`md`,onClick:D,busy:E.isPending&&!E.variables,disabled:!v.trim(),children:[o(`new.build`),` `,(0,S.jsx)(p,{className:`size-4`})]})]})]}),(0,S.jsx)(`div`,{className:`mt-4 flex flex-wrap justify-center gap-2`,children:w[g].map(e=>(0,S.jsx)(`button`,{type:`button`,onClick:()=>T(e),className:`rounded-full bg-paper-2 px-3.5 py-1.5 text-[0.8125rem] text-ink-2 transition hover:bg-paper-3 hover:text-ink`,children:e},e))})]}),(0,S.jsxs)(`section`,{className:`mx-auto max-w-5xl`,children:[(0,S.jsx)(`h2`,{className:`mt-16 mb-5 text-center font-medium text-[0.8125rem] text-ink-3 uppercase tracking-[0.08em]`,children:o(`new.orStarter`)}),(0,S.jsx)(i,{open:m.get(`starter`),busy:E.isPending&&!!E.variables,onUse:e=>n&&!E.isPending&&E.mutate(e.id)}),E.error?(0,S.jsx)(`p`,{className:`mt-3 text-center text-[0.875rem] text-rose`,children:E.error.message}):null]}),(0,S.jsx)(`div`,{className:`mt-8 flex justify-center`,children:(0,S.jsx)(C,{variant:`ghost`,label:o(`new.import`)})})]})}export{T as NewWizardPage};
@@ -0,0 +1,2 @@
1
+ import{r as e}from"./rolldown-runtime-hePW80VL.js";import{n as t,t as n}from"./jsx-runtime-BNakU3Ej.js";import{O as r,r as i}from"./logo-C4V2_3Ar.js";import{b as a,f as o,l as s,m as c,p as l,u}from"./Marketplace-CmeAQDOY.js";import{t as d}from"./useMutation-DKyQXgyj.js";import{Ct as f,Dt as p,Ht as m,Lt as h,Mt as g,Nt as _,Pt as v,Qt as y,Vt as ee,Wt as b,a as x,at as S,cn as C,ct as w,dn as te,en as T,fn as ne,gt as re,ht as ie,in as ae,it as E,lt as D,mn as oe,mt as O,ot as k,pn as se,pt as A,rt as j,st as ce,ut as M,vt as N,xt as P,y as F,yt as I}from"./ui-SKtUMhUq.js";import{_ as le,a as ue,b as L,c as de,d as fe,f as R,g as pe,h as me,i as he,l as ge,m as _e,n as z,o as ve,p as ye,s as be,u as xe,v as Se,x as B,y as V}from"./RunDrawer-DhKe5qPM.js";import{r as H,t as U}from"./RunnerView-Dzz0vC_M.js";import{n as Ce,r as W,t as G}from"./ReadOnly-B--cynCf.js";import{t as K}from"./upload-hT54Sh8P.js";import{c as q,l as we,s as Te}from"./session-DEXxyxEc.js";import{A as Ee,F as J,I as De,L as Oe,M as Y,N as ke,O as X,P as Ae,R as je,W as Me,_ as Ne,ct as Pe,d as Fe,f as Ie,g as Le,j as Re,k as ze,l as Be,lt as Ve,p as He,s as Ue,u as We,v as Ge}from"./index-CsKV2ZNO.js";import{a as Z,c as Ke,f as qe,i as Je,n as Ye,o as Xe,r as Ze,s as Qe,t as $e,u as et}from"./settings-menu-vtL00p0G.js";var tt={name:`layers`,size:24,node:[[`path`,{d:`M12.83 2.18a2 2 0 0 0-1.66 0L2.6 6.08a1 1 0 0 0 0 1.83l8.58 3.91a2 2 0 0 0 1.66 0l8.58-3.9a1 1 0 0 0 0-1.83z`,key:`zw3jo`}],[`path`,{d:`M2 12a1 1 0 0 0 .58.91l8.6 3.91a2 2 0 0 0 1.65 0l8.58-3.9A1 1 0 0 0 22 12`,key:`1wduqc`}],[`path`,{d:`M2 17a1 1 0 0 0 .58.91l8.6 3.91a2 2 0 0 0 1.65 0l8.58-3.9A1 1 0 0 0 22 17`,key:`kqbvx6`}]],aliases:[`layers-3`]};tt.node;var nt=ae(tt),rt={name:`music`,size:24,node:[[`path`,{d:`M9 18V5l12-2v13`,key:`1jmyc2`}],[`circle`,{cx:`6`,cy:`18`,r:`3`,key:`fqmcym`}],[`circle`,{cx:`18`,cy:`16`,r:`3`,key:`1hluhg`}]]};rt.node;var it=ae(rt),Q=e(t(),1),$=e(n(),1),at={backgroundImage:`repeating-conic-gradient(#c9c9c9 0% 25%, #dedede 0% 50%)`,backgroundSize:`16px 16px`};function ot({file:e,actions:t}){let[n,r]=(0,Q.useState)(e.description),i=(0,Q.useRef)(e.description),a=(0,Q.useRef)(null);(0,Q.useEffect)(()=>{e.description!==i.current&&(r(t=>t===i.current?e.description:t),i.current=e.description)},[e.description]),(0,Q.useLayoutEffect)(()=>{let e=a.current;e&&(e.style.height=`auto`,e.style.height=`${e.scrollHeight}px`)},[n]);let o=e.status===`pending`&&!n;return t.readOnly?n?(0,$.jsx)(`p`,{className:`text-[0.8125rem] text-ink-2 leading-snug`,children:n}):null:(0,$.jsx)(`textarea`,{ref:a,rows:1,value:n,maxLength:600,placeholder:f(o?`project.describing`:`project.description`),onChange:e=>r(e.target.value),onBlur:()=>{n.trim()!==e.description&&(i.current=n.trim(),t.describe(e.id,n.trim()))},className:`-mx-1 block w-[calc(100%+0.5rem)] resize-none overflow-hidden rounded-md bg-transparent px-1 py-0.5 text-[0.8125rem] text-ink-2 leading-snug outline-none transition placeholder:text-ink-4 hover:bg-paper-2 focus:bg-card focus:text-ink focus:ring-1 focus:ring-border`})}function st(e,t){confirm(f(`project.removeConfirm`,{name:e.name}))&&t.remove(e.id)}function ct({projectId:e,file:t,small:n}){let r=Ae(e,t.id);return t.mime.startsWith(`image/`)?(0,$.jsx)(`img`,{src:r,alt:``,loading:`lazy`,className:I(`size-full`,t.kind===`logo`?`object-contain p-3`:`object-cover`)}):t.mime.startsWith(`video/`)?(0,$.jsx)(`video`,{src:`${r}#t=0.1`,preload:`metadata`,controls:!n,className:`size-full object-cover`}):(0,$.jsx)(`div`,{className:`flex size-full items-center justify-center text-ink-3`,children:t.mime.startsWith(`audio/`)?(0,$.jsx)(it,{className:n?`size-5`:`size-7`}):(0,$.jsx)(m,{className:n?`size-5`:`size-7`})})}function lt({projectId:e,kind:t,files:n,actions:r,accept:i,addLabel:s,onPreview:c}){return(0,$.jsxs)(`div`,{className:`grid grid-cols-[repeat(auto-fill,minmax(184px,1fr))] gap-3`,children:[n.map((i,s)=>(0,$.jsxs)(`div`,{className:`group relative flex flex-col gap-1.5 rounded-lg bg-paper p-2 pb-2.5 ring-1 ring-border-soft`,children:[t===`logo`&&s===0?(0,$.jsx)(`span`,{className:`absolute -top-3 left-3 z-10 rounded-full ring-2 ring-card`,children:(0,$.jsx)(S,{tone:`ember`,children:f(`project.logoMain`)})}):null,(0,$.jsxs)(`div`,{className:`relative h-28 overflow-hidden rounded-md bg-paper-2`,style:t===`logo`?at:void 0,children:[c&&i.mime.startsWith(`image/`)?(0,$.jsx)(`button`,{type:`button`,"aria-label":`${f(`project.preview`)}: ${i.name}`,onClick:()=>c(i),className:`block size-full cursor-zoom-in`,children:(0,$.jsx)(ct,{projectId:e,file:i})}):(0,$.jsx)(ct,{projectId:e,file:i}),(0,$.jsxs)(`div`,{className:`absolute top-1 right-1 flex gap-1 opacity-0 transition focus-within:opacity-100 group-hover:opacity-100 coarse:opacity-100`,children:[c?(0,$.jsx)(w,{label:f(`project.preview`),onClick:()=>c(i),className:`size-8 bg-card shadow-soft`,children:(0,$.jsx)(a,{className:`size-4`})}):null,t===`logo`&&s>0&&!r.readOnly?(0,$.jsx)(w,{label:f(`project.logoMakeMain`),onClick:()=>r.order(`logo`,[i.id,...n.filter(e=>e.id!==i.id).map(e=>e.id)]),className:`size-8 bg-card shadow-soft`,children:(0,$.jsx)(o,{className:`size-4`})}):null,r.readOnly?null:(0,$.jsx)(w,{label:f(`project.remove`),onClick:()=>st(i,r),className:`size-8 bg-card shadow-soft hover:text-rose`,children:(0,$.jsx)(p,{className:`size-4`})})]})]}),t===`asset`?(0,$.jsx)(`div`,{className:`truncate px-0.5 text-[0.75rem] text-ink-3`,title:i.name,children:i.name}):null,(0,$.jsx)(ot,{file:i,actions:r})]},i.id)),s&&!r.readOnly?(0,$.jsxs)(ze,{accept:i,multiple:!1,onFiles:e=>r.upload(t,e),className:`min-h-28 flex-col p-3`,children:[r.busy?(0,$.jsx)(O,{className:`size-5`}):(0,$.jsx)(_,{className:`size-5`}),s]}):null]})}function ut({projectId:e,data:t,readOnly:n}){let r=De(e,n);return(0,$.jsxs)(Y,{title:f(`project.logos`),hint:f(`project.logosHint`),children:[(0,$.jsx)(lt,{projectId:e,kind:`logo`,files:t.files.filter(e=>e.kind===`logo`),actions:r,accept:`image/*`,addLabel:f(`project.logoAdd`)}),r.error?(0,$.jsx)(`p`,{className:`mt-3 text-[0.875rem] text-rose`,children:r.error}):null]})}var dt=e=>[(e.name.includes(`.`)?e.name.split(`.`).pop():e.mime.split(`/`).pop())?.toUpperCase().slice(0,5),ke(e.size)].filter(Boolean).join(` · `);function ft({projectId:e,file:t,actions:n,onClose:r}){let i=Ae(e,t.id);return(0,$.jsxs)(k,{open:!0,onClose:r,wide:`page`,title:t.name,children:[(0,$.jsxs)(`div`,{className:`-mt-2 mb-4 flex items-center justify-between gap-3`,children:[(0,$.jsx)(`span`,{className:`text-[0.8125rem] text-ink-3`,children:dt(t)}),(0,$.jsx)(`a`,{href:i,target:`_blank`,rel:`noreferrer`,"aria-label":f(`project.openOriginal`),title:f(`project.openOriginal`),className:`inline-flex size-9 items-center justify-center rounded-full text-ink-3 transition hover:bg-accent hover:text-ink`,children:(0,$.jsx)(b,{className:`size-4`})})]}),t.mime.startsWith(`image/`)?(0,$.jsx)(`div`,{className:`overflow-hidden rounded-lg`,style:at,children:(0,$.jsx)(`img`,{src:i,alt:``,className:`mx-auto max-h-[68dvh] object-contain`})}):t.mime.startsWith(`video/`)?(0,$.jsx)(`video`,{src:i,controls:!0,className:`max-h-[68dvh] w-full rounded-lg bg-black`}):(0,$.jsx)(`audio`,{src:i,controls:!0,className:`w-full`}),(0,$.jsx)(`div`,{className:`mt-4`,children:(0,$.jsx)(ot,{file:t,actions:n})})]})}function pt({projectId:e,file:t,actions:n,onPreview:r}){return(0,$.jsxs)(`li`,{className:`flex items-start gap-3 rounded-lg bg-paper p-2 ring-1 ring-border-soft`,children:[(0,$.jsx)(`button`,{type:`button`,"aria-label":`${f(`project.preview`)}: ${t.name}`,onClick:r,className:`size-14 shrink-0 cursor-zoom-in overflow-hidden rounded-md bg-paper-2`,children:(0,$.jsx)(ct,{projectId:e,file:t,small:!0})}),(0,$.jsxs)(`div`,{className:`flex min-w-0 flex-1 flex-col gap-1 py-0.5`,children:[(0,$.jsxs)(`div`,{className:`flex flex-wrap items-baseline gap-x-3`,children:[(0,$.jsx)(`button`,{type:`button`,onClick:r,title:t.name,className:`min-w-0 truncate font-medium text-[0.875rem] hover:underline`,children:t.name}),(0,$.jsx)(`span`,{className:`text-[0.75rem] text-ink-3`,children:dt(t)})]}),(0,$.jsx)(ot,{file:t,actions:n})]}),(0,$.jsxs)(`div`,{className:`flex shrink-0 items-start`,children:[(0,$.jsx)(w,{label:f(`project.preview`),onClick:r,children:(0,$.jsx)(a,{className:`size-4`})}),n.readOnly?null:(0,$.jsx)(w,{label:f(`project.remove`),onClick:()=>st(t,n),className:`hover:text-rose`,children:(0,$.jsx)(p,{className:`size-4`})})]})]})}function mt({projectId:e,data:t,readOnly:n}){let r=De(e,n),[i,a]=Oe(`assets`,`cards`),[o,s]=(0,Q.useState)(``),[c,l]=(0,Q.useState)(null),u=t.files.filter(e=>e.kind===`asset`),d=u.find(e=>e.id===c),p=o.trim().toLowerCase(),m=p?u.filter(e=>`${e.name} ${e.description}`.toLowerCase().includes(p)):u;return(0,$.jsxs)(Y,{title:f(`project.assets`),hint:f(`project.assetsHint`),children:[u.length?(0,$.jsx)(Ee,{layout:i,onToggle:a,children:(0,$.jsx)(Re,{value:o,onChange:s,placeholder:f(`project.assetSearch`)})}):null,m.length?(0,$.jsx)(`div`,{className:`mb-3`,children:i===`cards`?(0,$.jsx)(lt,{projectId:e,kind:`asset`,files:m,actions:r,onPreview:e=>l(e.id)}):(0,$.jsx)(`ul`,{className:`flex flex-col gap-2`,children:m.map(t=>(0,$.jsx)(pt,{projectId:e,file:t,actions:r,onPreview:()=>l(t.id)},t.id))})}):null,n?u.length?null:(0,$.jsx)(`p`,{className:`text-[0.875rem] text-ink-3`,children:f(`project.staysLocal`)}):(0,$.jsxs)(ze,{accept:`image/*,video/*,audio/*`,onFiles:e=>r.upload(`asset`,e),className:`h-16 w-full`,children:[r.busy?(0,$.jsx)(O,{className:`size-4`}):(0,$.jsx)(K,{className:`size-4`}),f(`project.drop`),` `,(0,$.jsx)(`span`,{className:`underline`,children:f(`project.assetAdd`)})]}),r.error?(0,$.jsx)(`p`,{className:`mt-3 text-[0.875rem] text-rose`,children:r.error}):null,d?(0,$.jsx)(ft,{projectId:e,file:d,actions:r,onClose:()=>l(null)}):null]})}function ht(e,t,n){return i({queryKey:[`project-file-text`,t.id,t.chars,n],queryFn:()=>x.get(`/api/studio/projects/${e}/files/${t.id}/text?limit=${n}`),enabled:t.status===`ready`,staleTime:6e4})}function gt(e){return((e.name.includes(`.`)?e.name.split(`.`).pop():``)||e.mime.split(`/`).pop()||``).toUpperCase().slice(0,5)}var _t=e=>[gt(e),e.pages?f(`project.pages`,{n:e.pages}):null,ke(e.size)].filter(Boolean).join(` · `),vt=2e5;function yt({projectId:e,fileId:t,readOnly:n,onGone:i}){let a=r(),o=je(e),s=_e(e),c=De(e,n),l=o.data?.files.find(e=>e.id===t),u=l?l.mime===`application/pdf`||l.mime.startsWith(`image/`):!1,[d,m]=(0,Q.useState)(null);if(!l)return o.isLoading?(0,$.jsx)(O,{className:`mx-auto text-ink-3`}):null;let h=d??(u?`original`:`text`),_=s.data?.items.find(e=>e.key===`f:${l.id}`),v=Ae(e,l.id),y=(e,t)=>(0,$.jsx)(`button`,{type:`button`,"aria-pressed":h===e,onClick:()=>m(e),className:I(`rounded-full px-3 py-1 text-[0.8125rem] transition`,h===e?`bg-paper-2 font-medium text-ink`:`text-ink-3 hover:text-ink`),children:t});return(0,$.jsxs)(`section`,{className:`flex flex-col gap-3`,children:[(0,$.jsxs)(`div`,{className:`flex items-center gap-2 px-1`,children:[(0,$.jsx)(`h2`,{className:`min-w-0 flex-1 truncate font-display font-semibold text-lg`,children:l.name}),(0,$.jsx)(`span`,{className:`text-[0.8125rem] text-ink-3 max-sm:hidden`,children:_t(l)}),(0,$.jsx)(`a`,{href:v,target:`_blank`,rel:`noreferrer`,"aria-label":f(`project.openOriginal`),title:f(`project.openOriginal`),className:`inline-flex size-9 items-center justify-center rounded-full text-ink-3 transition hover:bg-accent hover:text-ink`,children:(0,$.jsx)(b,{className:`size-4`})}),n?null:(0,$.jsxs)($.Fragment,{children:[(0,$.jsx)(w,{label:f(`project.reindex`),onClick:async()=>{await c.reindex(l.id),await a.invalidateQueries({queryKey:[`knowledge`,e]})},children:(0,$.jsx)(g,{className:`size-4`})}),(0,$.jsx)(w,{label:f(`know.deleteFile`),className:`hover:text-rose`,onClick:async()=>{confirm(f(`data.confirmDelete`,{title:l.name}))&&(await c.remove(l.id),await a.invalidateQueries({queryKey:[`knowledge`,e]}),i())},children:(0,$.jsx)(p,{className:`size-4`})})]})]}),(0,$.jsx)(R,{projectId:e,itemKey:`f:${l.id}`,has:_?.categories??[],originLabel:_?.originLabel??null,kept:!1,review:null,file:null,readOnly:n,onReviewed:()=>void 0}),(0,$.jsx)(`div`,{className:`px-1`,children:(0,$.jsx)(ot,{file:l,actions:c})}),l.status===`failed`?(0,$.jsx)(`p`,{className:`px-1 text-[0.875rem] text-rose`,children:l.error}):null,(0,$.jsxs)(E,{className:`flex flex-col`,children:[(0,$.jsxs)(`div`,{className:`flex items-center gap-1 border-border-soft border-b px-2 py-1.5`,children:[u?y(`original`,f(`project.original`)):null,y(`text`,f(`project.readText`))]}),h===`original`?l.mime===`application/pdf`?(0,$.jsx)(`iframe`,{src:v,title:l.name,className:`h-[70dvh] w-full rounded-b-xl bg-paper-2`}):(0,$.jsx)(`img`,{src:v,alt:``,className:`mx-auto max-h-[70dvh] object-contain p-4`}):(0,$.jsx)(bt,{projectId:e,file:l})]})]})}function bt({projectId:e,file:t}){let n=ht(e,t,vt);return n.isLoading||t.status===`pending`?(0,$.jsx)(`div`,{className:`flex h-40 items-center justify-center text-ink-3`,children:(0,$.jsx)(O,{})}):n.data?.text?(0,$.jsxs)(`div`,{className:`overflow-x-auto p-4 sm:p-5`,children:[(0,$.jsx)(F,{text:n.data.text,className:`text-[0.875rem]`}),n.data.chars>n.data.text.length?(0,$.jsx)(`p`,{className:`mt-3 text-[0.8125rem] text-ink-3`,children:f(`project.textCut`,{shown:n.data.text.length.toLocaleString(),total:n.data.chars.toLocaleString()})}):null]}):(0,$.jsx)(`p`,{className:`py-8 text-center text-[0.875rem] text-ink-3`,children:f(`project.noText`)})}var xt=[`text`,`longtext`,`number`,`date`,`url`,`email`,`phone`,`boolean`],St=/^(\d{4}-\d{2}-\d{2}|\d{1,2}\.\s?\d{1,2}\.\s?\d{4})$/,Ct=/^[+-]?\d{1,3}([.,\s']?\d{3})*([.,]\d+)?$/,wt=/^[^\s@]+@[^\s@]+\.[^\s@]{2,}$/,Tt=/^(https?:\/\/|www\.)\S+$/i,Et=/^\+?[\d\s()/.-]{7,20}$/,Dt=/^(ja|nein|yes|no|true|false)$/i;function Ot(e){let t=e.trim();return t?t.includes(`
2
+ `)||t.length>140?`longtext`:Dt.test(t)?`boolean`:wt.test(t)?`email`:Tt.test(t)?`url`:St.test(t)?`date`:Ct.test(t)&&!/^(\+|0\d)/.test(t)?`number`:Et.test(t)&&t.replace(/\D/g,``).length>=7?`phone`:`text`:`text`}function kt(e,t=[]){let n=e.toLowerCase().replace(/ä/g,`ae`).replace(/ö/g,`oe`).replace(/ü/g,`ue`).replace(/ß/g,`ss`).normalize(`NFD`).replace(/[^a-z0-9]+/g,`_`).replace(/^_+|_+$/g,``).slice(0,40)||`fakt`,r=n;for(let e=2;t.includes(r);e++)r=`${n}_${e}`;return r}var At=[{key:`adresse`,de:`Adresse`,en:`Address`},{key:`plz`,de:`PLZ`,en:`Postcode`},{key:`ort`,de:`Ort`,en:`City`},{key:`uid`,de:`UID`,en:`VAT id`},{key:`telefon`,de:`Telefon`,en:`Phone`},{key:`e_mail`,de:`E-Mail`,en:`Email`},{key:`website`,de:`Website`,en:`Website`},{key:`iban`,de:`IBAN`,en:`IBAN`}],jt={facts:100,colors:12,files:{logo:8,asset:100,document:2e3},bytes:{logo:5e6,asset:15e6,video:8e7,document:3e7}},Mt=/^#[0-9a-fA-F]{6}$/;function Nt({onAdd:e,onClose:t}){let[n,r]=(0,Q.useState)(`#e0531b`),[i,a]=(0,Q.useState)(``),o=Mt.test(n);return(0,$.jsx)(k,{open:!0,onClose:t,title:f(`project.colorAddTitle`),children:(0,$.jsxs)(`form`,{onSubmit:r=>{r.preventDefault(),o&&(e({name:i.trim(),value:n.toLowerCase()}),t())},className:`flex flex-col gap-5`,children:[(0,$.jsxs)(`div`,{children:[(0,$.jsx)(M,{children:f(`project.colorValue`)}),(0,$.jsxs)(`div`,{className:`flex items-center gap-2`,children:[(0,$.jsx)(ie,{value:o?n:`#888888`,onChange:e=>r(e.target.value)}),(0,$.jsx)(D,{value:n,placeholder:`#e0531b`,spellCheck:!1,onChange:e=>r(e.target.value.trim()),className:`font-mono text-[0.875rem]`})]})]}),(0,$.jsxs)(`div`,{children:[(0,$.jsx)(M,{children:f(`project.colorUseLabel`)}),(0,$.jsx)(D,{autoFocus:!0,value:i,maxLength:120,placeholder:f(`project.colorName`),onChange:e=>a(e.target.value)}),(0,$.jsx)(`p`,{className:`mt-1.5 text-[0.8125rem] text-ink-3`,children:f(`project.colorUse`)})]}),(0,$.jsxs)(`div`,{className:`flex justify-end gap-2`,children:[(0,$.jsx)(j,{variant:`ghost`,onClick:t,children:f(`common.cancel`)}),(0,$.jsx)(j,{type:`submit`,disabled:!o,children:f(`project.add`)})]})]})})}function Pt({colors:e,save:t,readOnly:n}){let r=(0,Q.useRef)(0),[i,a]=(0,Q.useState)(()=>e.map(e=>({...e,id:`c${r.current++}`}))),[o,s]=(0,Q.useState)(!1),c=J(i.filter(e=>Mt.test(e.value)).map(({name:e,value:t})=>({name:e.trim(),value:t})),t),l=(e,t)=>a(n=>n.map(n=>n.id===e?{...n,...t}:n));return(0,$.jsxs)(Y,{title:f(`project.colors`),hint:f(`project.colorsHint`),save:c,locked:n,children:[(0,$.jsx)(`div`,{className:`flex flex-col gap-2`,children:i.map((e,t)=>(0,$.jsxs)(`div`,{className:`flex items-center gap-2`,children:[(0,$.jsx)(ie,{value:Mt.test(e.value)?e.value:`#888888`,onChange:t=>l(e.id,{value:t.target.value})}),(0,$.jsx)(D,{value:e.name,placeholder:f(`project.colorName`),maxLength:120,onChange:t=>l(e.id,{name:t.target.value}),className:`min-w-0 flex-1`}),(0,$.jsx)(D,{value:e.value,placeholder:`#e0531b`,spellCheck:!1,onChange:t=>l(e.id,{value:t.target.value.trim()}),className:`w-28 font-mono text-[0.8125rem]`}),(0,$.jsxs)(`div`,{className:`flex w-24 shrink-0 items-center justify-end max-sm:w-auto`,children:[t===0?(0,$.jsx)(`span`,{className:`mr-1 max-sm:hidden`,children:(0,$.jsx)(S,{tone:`ember`,children:f(`project.colorAccent`)})}):n?null:(0,$.jsx)(w,{label:f(`project.colorFirst`),onClick:()=>a(t=>[e,...t.filter(t=>t.id!==e.id)]),children:(0,$.jsx)(T,{className:`size-4`})}),n?null:(0,$.jsx)(w,{label:f(`project.remove`),onClick:()=>a(t=>t.filter(t=>t.id!==e.id)),className:`hover:text-rose`,children:(0,$.jsx)(p,{className:`size-4`})})]})]},e.id))}),i.length&&!n?(0,$.jsx)(`p`,{className:`mt-1.5 text-[0.8125rem] text-ink-3`,children:f(`project.colorUse`)}):null,i.length<jt.colors&&!n?(0,$.jsxs)(j,{variant:`secondary`,size:`sm`,className:i.length?`mt-3`:void 0,onClick:()=>s(!0),children:[(0,$.jsx)(_,{className:`size-4`}),` `,f(`project.colorAdd`)]}):null,o?(0,$.jsx)(Nt,{onClose:()=>s(!1),onAdd:e=>a(t=>[...t,{...e,id:`c${r.current++}`}])}):null]})}var Ft=e=>/^(ja|yes|true)$/i.test(e.trim()),It={text:u,longtext:W,number:L,date:B,url:ee,email:Pe,phone:H,boolean:V};function Lt({type:e,detected:t,onChange:n}){let[r,i]=(0,Q.useState)(!1),[a,o]=(0,Q.useState)(!1),c=(0,Q.useRef)(null);(0,Q.useEffect)(()=>{if(!r)return;let e=e=>{c.current?.contains(e.target)||i(!1)},t=e=>e.key===`Escape`&&i(!1);return document.addEventListener(`mousedown`,e),document.addEventListener(`keydown`,t),()=>{document.removeEventListener(`mousedown`,e),document.removeEventListener(`keydown`,t)}},[r]);let l=It[e??t],u=`${f(`project.factType`)}: ${f(`project.type.${e??t}`)}`,d=`flex w-full items-center gap-3 rounded-lg px-3 py-2 text-left text-[0.875rem] text-ink-2 hover:bg-accent hover:text-ink`,p=e=>{n(e),i(!1)};return(0,$.jsxs)(`div`,{className:`relative`,ref:c,children:[(0,$.jsx)(`button`,{type:`button`,"aria-label":u,title:u,"aria-haspopup":`menu`,"aria-expanded":r,onClick:e=>{o(window.innerHeight-e.currentTarget.getBoundingClientRect().bottom<400),i(e=>!e)},className:I(`inline-flex size-11 items-center justify-center rounded-lg transition hover:bg-accent hover:text-ink`,r?`bg-accent text-ink`:e?`text-ink-2`:`text-ink-4`),children:(0,$.jsx)(l,{className:`size-4`})}),r?(0,$.jsxs)(`div`,{role:`menu`,className:I(`absolute right-0 z-50 w-56 animate-rise rounded-xl bg-card p-1.5 shadow-overlay ring-1 ring-border-soft`,a?`bottom-12`:`top-12`),children:[(0,$.jsxs)(`button`,{type:`button`,role:`menuitemradio`,"aria-checked":!e,className:d,onClick:()=>p(void 0),children:[(0,$.jsx)(s,{className:`size-4 shrink-0`}),(0,$.jsx)(`span`,{className:`flex-1`,children:f(`project.factAuto`)}),(0,$.jsx)(`span`,{className:`text-[0.75rem] text-ink-4`,children:f(`project.type.${t}`)}),(0,$.jsx)(y,{className:I(`size-4 shrink-0`,e&&`invisible`)})]}),(0,$.jsx)(`div`,{className:`mx-2 my-1 h-px bg-border-soft`}),xt.map(t=>{let n=It[t];return(0,$.jsxs)(`button`,{type:`button`,role:`menuitemradio`,"aria-checked":e===t,className:d,onClick:()=>p(t),children:[(0,$.jsx)(n,{className:`size-4 shrink-0`}),(0,$.jsx)(`span`,{className:`flex-1`,children:f(`project.type.${t}`)}),(0,$.jsx)(y,{className:I(`size-4 shrink-0`,e!==t&&`invisible`)})]},t)})]}):null]})}function Rt({facts:e,save:t,readOnly:n}){let r=(0,Q.useRef)(0),i=(0,Q.useRef)(null),[a,o]=(0,Q.useState)(()=>e.map(e=>({...e,id:`f${r.current++}`}))),s=J(a.filter(e=>e.key&&e.label.trim()).map(({key:e,label:t,value:n,type:r})=>({key:e,label:t.trim(),value:n,...r?{type:r}:{}})),t),c=(e,t)=>o(n=>n.map(n=>n.id===e?{...n,...t}:n)),l=(e,t,n=!1)=>{let a=`f${r.current++}`;i.current=`${a}:${t}`;let s={id:a,key:``,label:``,value:``,...e};o(e=>n?[s,...e]:[...e,s])},u=e=>t=>{t&&i.current===e&&(i.current=null,t.focus())},d=At.filter(e=>!a.some(t=>t.key===e.key));return(0,$.jsxs)(Y,{title:f(`project.facts`),hint:f(`project.factsHint`),save:s,locked:n,action:a.length<jt.facts&&!n?(0,$.jsxs)(j,{variant:`secondary`,size:`sm`,onClick:()=>l({},`label`,!0),children:[(0,$.jsx)(_,{className:`size-4`}),` `,f(`project.factAdd`)]}):null,children:[(0,$.jsx)(`div`,{className:`flex flex-col gap-2`,children:a.map(e=>{let t=Ot(e.value),r=e.type??t;return(0,$.jsxs)(`div`,{className:`grid grid-cols-[minmax(0,1fr)_auto_auto] items-start gap-x-1 gap-y-2 sm:grid-cols-[minmax(0,2fr)_minmax(0,3fr)_auto_auto]`,children:[(0,$.jsx)(D,{ref:u(`${e.id}:label`),value:e.label,placeholder:f(`project.factLabel`),title:e.key?`{{facts.${e.key}}}`:void 0,onChange:t=>c(e.id,{label:t.target.value}),onBlur:()=>{!e.key&&e.label.trim()&&c(e.id,{key:kt(e.label,a.map(e=>e.key))})},className:`max-sm:col-span-3 max-sm:font-medium sm:mr-1`}),e.type===`boolean`?(0,$.jsxs)(`div`,{className:`flex h-11 items-center gap-3`,children:[(0,$.jsx)(re,{checked:Ft(e.value),label:e.label,onChange:t=>c(e.id,{value:f(t?`project.yes`:`project.no`)})}),(0,$.jsx)(`span`,{className:`text-[0.875rem] text-ink-2`,children:Ft(e.value)?f(`project.yes`):f(`project.no`)})]}):(0,$.jsx)(N,{ref:u(`${e.id}:value`),rows:1,minRows:r===`longtext`?2:1,maxRows:10,value:e.value,placeholder:f(`project.factValue`),onChange:t=>c(e.id,{value:t.target.value}),className:`min-h-11`}),(0,$.jsx)(Lt,{type:e.type,detected:t,onChange:t=>c(e.id,{type:t})}),n?null:(0,$.jsx)(w,{label:f(`project.remove`),onClick:()=>o(t=>t.filter(t=>t.id!==e.id)),className:`size-11 rounded-lg hover:text-rose`,children:(0,$.jsx)(p,{className:`size-4`})})]},e.id)})}),a.length<jt.facts&&!n?(0,$.jsxs)(`div`,{className:`flex flex-wrap items-center gap-2 ${a.length?`mt-4`:``}`,children:[(0,$.jsxs)(j,{variant:`secondary`,size:`sm`,onClick:()=>l({},`label`),children:[(0,$.jsx)(_,{className:`size-4`}),` `,f(`project.factAdd`)]}),d.map(e=>(0,$.jsxs)(`button`,{type:`button`,onClick:()=>l({key:e.key,label:P===`en`?e.en:e.de},`value`),className:`inline-flex h-8 items-center gap-1 rounded-full bg-paper-2 px-3 text-[0.8125rem] text-ink-2 transition hover:bg-paper-3 hover:text-ink`,children:[(0,$.jsx)(_,{className:`size-3.5`}),` `,P===`en`?e.en:e.de]},e.key))]}):null]})}function zt({project:e,save:t}){let[n,r]=(0,Q.useState)(e.brand.name??``),[i,a]=(0,Q.useState)(e.brand.about??``),o=J({name:n.trim(),about:i.trim()},e=>t({brand:e}));return(0,$.jsx)(Y,{title:f(`project.base`),hint:f(`project.baseHint`),save:o,locked:e.readOnly,children:(0,$.jsxs)(`div`,{className:`flex flex-col gap-5`,children:[(0,$.jsxs)(`div`,{children:[(0,$.jsx)(M,{children:f(`project.title`)}),(0,$.jsx)(D,{value:n,maxLength:120,onChange:e=>r(e.target.value)}),(0,$.jsx)(`p`,{className:`mt-1.5 text-[0.8125rem] text-ink-3`,children:f(`project.titleHint`)})]}),(0,$.jsxs)(`div`,{children:[(0,$.jsx)(M,{children:f(`project.about`)}),(0,$.jsx)(N,{minRows:4,value:i,onChange:e=>a(e.target.value)}),(0,$.jsx)(`p`,{className:`mt-1.5 text-[0.8125rem] text-ink-3`,children:f(`project.aboutHint`)})]})]})})}function Bt({project:e,group:t,children:n}){let i=r(),a=je(e.id),[o,s]=(0,Q.useState)(0),c=async t=>{await x.patch(`/api/studio/projects/${e.id}`,t),await i.invalidateQueries({queryKey:[`projects`]})},l=d({mutationFn:()=>x.del(`/api/studio/projects/${e.id}`),onSuccess:()=>i.invalidateQueries({queryKey:[`projects`]})}),u=we(),p=q(),m=a.data??{files:[],embeddings:!0},h=`${e.id}:${o}`,g=e.readOnly,_=t===`knowledge`;return Me(g?{}:{title:f(_?`project.assistantTitleKnowledge`:`project.assistantTitle`),hello:f(_?`project.assistantHelloKnowledge`:`project.assistantHello`),placeholder:f(_?`project.assistantComposerKnowledge`:`project.assistantComposer`),suggestions:_?[{label:f(`assistant.suggest.knowledgeHow`)},{label:f(`assistant.suggest.knowledgeSite`),fill:!0},{label:f(`assistant.suggest.knowledgeCategories`)}]:[{label:f(`assistant.suggest.readSite`),fill:!0},{label:f(`assistant.suggest.missing`)},{label:f(`assistant.suggest.facts`)}],summary:_?void 0:[e.brand.name?`title "${e.brand.name}"`:`no title`,`${e.facts.length} facts`,`${e.brand.colors?.length??0} colours`,`${m.files.filter(e=>e.kind===`logo`).length} logos`].join(` · `),onChanged:()=>s(e=>e+1)}),(0,$.jsxs)(`div`,{className:`flex flex-col gap-9`,children:[g?(0,$.jsx)(G,{children:Ce(e)}):null,t===`info`?(0,$.jsxs)($.Fragment,{children:[(0,$.jsx)(X,{id:`base`,children:(0,$.jsx)(zt,{project:e,save:c},`base:${h}`)}),(0,$.jsx)(X,{id:`logos`,children:(0,$.jsx)(ut,{projectId:e.id,data:m,readOnly:g})}),(0,$.jsx)(X,{id:`colors`,children:(0,$.jsx)(Pt,{colors:e.brand.colors??[],save:e=>c({brand:{colors:e}}),readOnly:g},`colors:${h}`)}),(0,$.jsx)(X,{id:`assets`,children:(0,$.jsx)(mt,{projectId:e.id,data:m,readOnly:g})}),(0,$.jsx)(X,{id:`facts`,children:(0,$.jsx)(Rt,{facts:e.facts,save:e=>c({facts:e}),readOnly:g},`facts:${h}`)})]}):null,n,t===`info`&&u&&!g&&p?(0,$.jsxs)(`div`,{children:[(0,$.jsx)(j,{variant:`danger`,busy:l.isPending,onClick:()=>confirm(`${f(`settings.delete`)}?`)&&l.mutate(),children:f(`settings.delete`)}),l.error?(0,$.jsx)(`p`,{className:`mt-2 text-[0.875rem] text-rose`,children:l.error.message}):null]}):null]})}var Vt={q:``,mode:``,days:0};function Ht(e,t,n){let r=new URLSearchParams;t&&r.set(`wizard`,t),n.q.trim()&&r.set(`q`,n.q.trim()),n.mode&&r.set(`mode`,n.mode),n.days&&r.set(`days`,String(n.days));let a=r.toString();return i({queryKey:[`results`,e,a],queryFn:()=>x.get(`/api/studio/projects/${e}/results${a&&`?${a}`}`),enabled:!!e,placeholderData:e=>e,refetchInterval:15e3})}function Ut({filter:e,onFilter:t}){let[n,r]=(0,Q.useState)(e.q);return(0,Q.useEffect)(()=>{if(n===e.q)return;let r=setTimeout(()=>t({...e,q:n}),250);return()=>clearTimeout(r)},[n,e,t]),(0,$.jsxs)(`div`,{className:`flex flex-wrap gap-2`,children:[(0,$.jsxs)(`div`,{className:`relative min-w-0 flex-1 basis-56`,children:[(0,$.jsx)(l,{className:`-translate-y-1/2 pointer-events-none absolute top-1/2 left-3 size-4 text-ink-3`}),(0,$.jsx)(D,{type:`search`,value:n,onChange:e=>r(e.target.value),placeholder:f(`space.resultsSearch`),"aria-label":f(`space.resultsSearch`),className:`w-full pl-9`})]}),(0,$.jsx)(A,{value:e.mode,onChange:n=>t({...e,mode:n}),options:[{value:``,label:f(`space.resultsModeAll`)},{value:`live`,label:`Live`},{value:`test`,label:`Test`}],className:`w-32`}),(0,$.jsx)(A,{value:String(e.days),onChange:n=>t({...e,days:Number(n)}),options:[{value:`0`,label:f(`space.resultsAnyTime`)},{value:`1`,label:f(`space.resultsDay`)},{value:`7`,label:f(`space.resultsDays`,{n:7})},{value:`30`,label:f(`space.resultsDays`,{n:30})}],className:`w-44`})]})}function Wt({data:e,wizardId:t,filter:n,onFilter:r}){let[i,a]=(0,Q.useState)(null),o=t=>e.wizards.find(e=>e.id===t)?.title??``,s=new Intl.DateTimeFormat(P,{dateStyle:`medium`,timeStyle:`short`});return(0,$.jsxs)($.Fragment,{children:[(0,$.jsxs)(Y,{title:t?o(t):f(`space.resultsAll`),hint:f(`space.resultsHint`),plain:!0,children:[(0,$.jsx)(Ut,{filter:n,onFilter:r}),e.runs.length?(0,$.jsx)(E,{className:`flex flex-col p-1.5`,children:e.runs.map(e=>(0,$.jsxs)(`button`,{type:`button`,onClick:()=>a(e),className:`flex items-center gap-3 rounded-lg px-3 py-2.5 text-left transition hover:bg-accent`,children:[(0,$.jsxs)(`div`,{className:`min-w-0 flex-1`,children:[(0,$.jsx)(`div`,{className:`truncate text-[0.875rem]`,children:t?s.format(new Date(e.doneAt)):o(e.wizardId)}),(0,$.jsxs)(`div`,{className:`truncate text-[0.75rem] text-ink-3`,children:[t?null:`${s.format(new Date(e.doneAt))} · `,f(`space.resultCredits`,{n:e.credits})]})]}),e.assets?(0,$.jsxs)(`span`,{className:`inline-flex items-center gap-1 text-[0.75rem] text-ink-3 tabular-nums`,title:f(`space.resultFiles`,{n:e.assets}),children:[(0,$.jsx)(h,{className:`size-3.5`}),e.assets]}):null,e.mode===`test`?(0,$.jsx)(S,{children:`Test`}):(0,$.jsxs)(S,{tone:`live`,children:[`Live v`,e.version]})]},e.id))}):(0,$.jsx)(E,{children:(0,$.jsx)(ce,{children:n.q.trim()||n.mode||n.days?f(`space.resultsNone`):f(`space.resultsEmpty`)})})]}),i?(0,$.jsx)(z,{header:(0,$.jsxs)($.Fragment,{children:[(0,$.jsx)(`span`,{className:`min-w-0 flex-1 truncate font-medium text-[0.875rem]`,children:o(i.wizardId)}),i.mode===`test`?(0,$.jsx)(S,{children:`Test`}):(0,$.jsxs)(S,{tone:`live`,children:[`Live v`,i.version]})]}),onClose:()=>a(null),children:(0,$.jsx)(U,{runId:i.id,compact:!0},i.id)}):null]})}function Gt({project:e,save:t}){let[n,r]=(0,Q.useState)(!1),[i,a]=(0,Q.useState)(e.name),o=d({mutationFn:()=>t({name:i.trim()}),onSuccess:()=>r(!1)});return(0,$.jsxs)($.Fragment,{children:[(0,$.jsx)(w,{label:f(`project.rename`),onClick:()=>{a(e.name),r(!0)},children:(0,$.jsx)(v,{className:`size-4`})}),(0,$.jsx)(k,{open:n,onClose:()=>r(!1),title:f(`project.rename`),children:(0,$.jsxs)(`form`,{onSubmit:e=>{e.preventDefault(),i.trim()&&o.mutate()},children:[(0,$.jsx)(D,{"data-autofocus":!0,value:i,maxLength:80,onChange:e=>a(e.target.value)}),o.error?(0,$.jsx)(`p`,{className:`mt-3 text-[0.875rem] text-rose`,children:o.error.message}):null,(0,$.jsxs)(`div`,{className:`mt-5 flex justify-end gap-2`,children:[(0,$.jsx)(j,{variant:`ghost`,onClick:()=>r(!1),children:f(`common.cancel`)}),(0,$.jsx)(j,{type:`submit`,busy:o.isPending,disabled:!i.trim(),children:f(`settings.save`)})]})]})})]})}function Kt({project:e}){let t=r();return(0,$.jsxs)(`div`,{className:`flex items-center gap-1`,children:[(0,$.jsx)(Ge,{}),e.readOnly?null:(0,$.jsx)(Gt,{project:e,save:async n=>{await x.patch(`/api/studio/projects/${e.id}`,n),await t.invalidateQueries({queryKey:[`projects`]})}})]})}function qt(e){let t=e.join(` `),[n,r]=(0,Q.useState)(e[0]);return(0,Q.useEffect)(()=>{let e=t.split(` `),n=0,i=()=>{n=0;let t=Le(),i=t.scrollTop>0&&t.clientHeight+t.scrollTop>=t.scrollHeight-4,a=(t===document.documentElement?0:t.getBoundingClientRect().top)+Math.max(120,t.clientHeight/3),o=e[0];for(let t of e){let e=document.getElementById(t)?.getBoundingClientRect().top;e!==void 0&&e<=a&&(o=t)}r(i?e.at(-1):o)},a=()=>{n||=requestAnimationFrame(i)};return i(),window.addEventListener(`scroll`,a,{passive:!0,capture:!0}),window.addEventListener(`resize`,a),()=>{cancelAnimationFrame(n),window.removeEventListener(`scroll`,a,{capture:!0}),window.removeEventListener(`resize`,a)}},[t]),n}function Jt(e,t){let n=window.matchMedia(`(prefers-reduced-motion: reduce)`).matches;document.getElementById(e)?.scrollIntoView({block:`start`,behavior:t&&!n?`smooth`:`auto`})}function Yt({groups:e,current:t,onPick:n}){return e.map(e=>{let r=e.sections.map(e=>(0,$.jsx)(Z,{icon:e.icon??c,label:e.label,selected:e.id===t,onPick:()=>n(e.id)},e.id));return e.label?(0,$.jsx)(Je,{label:e.label,children:r},e.plugin):(0,$.jsx)(`ul`,{className:`flex flex-col gap-0.5`,children:r},`own`)})}function Xt(){let{group:e}=se(),[t,n]=oe(),r=ne(),i=te(),{hash:a}=i,{project:o,loading:c}=Te(),l=we(),u=Be(),d=et(),[p,m]=(0,Q.useState)(null),[h,g]=(0,Q.useState)(null),[_,v]=(0,Q.useState)(null),y=Fe(e)?e:void 0,ee=i.state?.parts===!0,b=He().map(e=>({...e,to:`/space/${e.id}`})),x=b.find(e=>e.id===y),S=t.get(`show`),w=y?S?2:1:0,T=d?Math.min(w,1):y&&_!==y&&!ee?1:0,re=qe(T),ie=qe(w),ae=(0,Q.useMemo)(()=>({slot:p,narrow:d,setDetail:g}),[p,d]),E=o?o.brand.name?.trim()||o.name:f(`nav.project`),D=y&&y!==`results`?Ie(y,u):[],O=y?Ie(y,u).filter(e=>e.plugin):[],k=qt([...D,...y===`results`?O:[]].flatMap(e=>e.sections.map(e=>e.id))),A=y===`results`&&S&&S!==`all`?S:null,[j,M]=(0,Q.useState)(Vt),N=Ht(y===`results`?o?.id:void 0,A,j),P=N.data?.wizards.find(e=>e.id===A)?.title,F=y===`data`&&S&&S!==`all`||y===`knowledge`&&S&&/^[ptfcvs]:/.test(S)?S:null,L=F?.startsWith(`s:`)?u.spaceSections.find(e=>e.id===F.slice(2)):void 0,R=y===`knowledge`&&F&&/^[ptf]:/.test(F)?F:null,z=de(y===`data`?o?.id:void 0),B=_e(y===`knowledge`?o?.id:void 0),V=Se(F?.startsWith(`v:`)?F.slice(2):``),H=B.data?.categories.find(e=>e.id===(F?.startsWith(`c:`)?F.slice(2):V.data?.category.id)),U=y===`knowledge`?L?L.label():F?.startsWith(`v:`)?V.data&&`${V.data.category.name}: ${V.data.value}`:F?.startsWith(`c:`)?H?.name:B.data?.items.find(e=>e.key===F)?.title:z.data?be(z.data).flatMap(e=>e.items).find(e=>e.key===F)?.title:void 0;Ne([{label:f(`nav.project`),to:`/space`},...x?[{label:x.label,to:`/space/${x.id}`}]:[],...x&&(h??P??U)?[{label:h??P??U}]:[]]);let Ce={p:`page`,t:`table`,f:`file`,c:`kategorie`,v:`kategorie value`,s:`plugin section`};Me({...y===`data`||y===`results`?{compact:!0}:{},...y===`data`?{suggestions:[{label:f(`assistant.suggest.dataWhat`)},{label:f(`assistant.suggest.dataWho`)},{label:f(`assistant.suggest.dataEdit`)}]}:y===`results`?{suggestions:[{label:f(`assistant.suggest.resultsFailed`)},{label:f(`assistant.suggest.resultsCost`)},{label:f(`assistant.suggest.resultsShare`)}]}:{},...F&&U?{open:{kind:Ce[F[0]]??`item`,id:F.slice(2),label:U}}:A&&P?{open:{kind:`wizard`,id:A,label:P}}:{}});let W=y===`results`||y===`data`||F?a.slice(1):S||a.slice(1),G=(0,Q.useRef)(``);if((0,Q.useEffect)(()=>{let e=`${y}#${W}`;W&&G.current!==e&&document.getElementById(W)&&(G.current=e,requestAnimationFrame(()=>Jt(W,!1)))},[y,W,o?.id,u.spaceSections]),!y){let t=a.slice(1),n=t?We(t,u):null;if(n===`knowledge`&&u.spaceSections.some(e=>e.id===t))return(0,$.jsx)(C,{to:`/space/knowledge?show=s:${t}`,replace:!0});if(n)return(0,$.jsx)(C,{to:d?`/space/${n}?show=${t}`:{pathname:`/space/${n}`,hash:t},replace:!0});if(t&&u.status!==`ready`)return null;if(e!==void 0||!d)return(0,$.jsx)(C,{to:`/space/info`,replace:!0,state:{parts:!0}})}if(y===`knowledge`&&!S&&u.spaceSections.some(e=>e.id===a.slice(1)))return(0,$.jsx)(C,{to:`/space/knowledge?show=s:${a.slice(1)}`,replace:!0});let K=e=>{if(d){r({search:`?show=${e}`});return}G.current=`${y}#${e}`,Jt(e,!0),r({search:``,hash:e},{replace:!0})},q=e=>d?n({show:e}):n(e===`all`?{}:{show:e},{replace:!0}),Ee=e=>e.flatMap(e=>e.sections).map(e=>u.spaceSections.find(t=>t.id===e.id)).filter(e=>e!==void 0).map(e=>(0,$.jsx)(X,{id:e.id,children:(0,$.jsx)(Y,{title:e.label(),hint:e.hint?.(),plain:!0,children:(0,$.jsx)(Ue,{of:e,children:(0,$.jsx)(e.component,{})})})},e.serial)),J=d?void 0:k;return(0,$.jsx)(Xe.Provider,{value:ae,children:(0,$.jsx)(`div`,{className:`animate-rise`,children:(0,$.jsxs)(`div`,{className:`grid gap-6 md:grid-cols-[13.5rem_minmax(0,1fr)] md:gap-8 lg:grid-cols-[15rem_minmax(0,1fr)] lg:gap-10`,children:[(0,$.jsxs)(`aside`,{className:I(`min-w-0 md:sticky md:top-6 md:self-start`,d&&w===2&&`hidden`,d&&ie===`back`&&Ke(`back`)),children:[(0,$.jsx)(Ye,{title:E,open:T===1?x??null:null,onBack:()=>d?r(`/space`):v(y??null)}),(0,$.jsx)(`div`,{className:I(Ke(re)),children:T===0?(0,$.jsx)(Ze,{entries:b,current:d?void 0:x,onPick:()=>v(null)}):(0,$.jsx)(`div`,{ref:m})},T)]}),y?(0,$.jsxs)(`div`,{className:I(`min-w-0`,d&&w<2&&`hidden`,d&&ie===`deeper`&&Ke(`deeper`)),children:[d?(0,$.jsx)(`div`,{className:`mb-3`,children:(0,$.jsx)($e,{label:x?.label??E,onBack:()=>r(`/space/${y}`)})}):null,l&&o?(0,$.jsx)(`div`,{className:`mb-6`,children:(0,$.jsx)(Kt,{project:o})}):null,y===`results`?(0,$.jsxs)(Qe,{children:[(0,$.jsxs)(`ul`,{className:`flex flex-col gap-0.5`,children:[(0,$.jsx)(Z,{icon:nt,label:f(`space.resultsAll`),selected:!d&&!A,onPick:()=>q(`all`)}),N.data?.wizards.filter(e=>e.results||e.id===A).map(e=>(0,$.jsx)(Z,{icon:s,label:e.title,badge:e.results?(0,$.jsx)(`span`,{className:`text-[0.75rem] text-ink-3 tabular-nums`,children:e.results}):null,selected:!d&&e.id===A,onPick:()=>q(e.id)},e.id))]}),(0,$.jsx)(Yt,{groups:O,current:J,onPick:K})]}):y===`data`?(0,$.jsxs)(Qe,{children:[(0,$.jsx)(`ul`,{className:`flex flex-col gap-0.5`,children:(0,$.jsx)(Z,{icon:Ve,label:f(`data.all`),selected:!d&&!F,onPick:()=>q(`all`)})}),z.data?be(z.data).map(e=>(0,$.jsx)(Je,{label:e.label,children:e.items.map(e=>(0,$.jsx)(Z,{icon:ue[e.kind],label:e.title,selected:!d&&e.key===F,onPick:()=>q(e.key)},e.key))},e.key)):null,(0,$.jsx)(Yt,{groups:O,current:J,onPick:K})]}):y===`knowledge`?(0,$.jsxs)(Qe,{children:[(0,$.jsx)(`ul`,{className:`flex flex-col gap-0.5`,children:(0,$.jsx)(Z,{icon:Ve,label:f(`know.all`),selected:!(d||F),onPick:()=>q(`all`)})}),B.data?.categories.length?(0,$.jsx)(Je,{label:f(`know.categories`),children:B.data.categories.map(e=>(0,$.jsx)(Z,{icon:me[e.type],label:e.name,badge:(0,$.jsx)(`span`,{className:`text-[0.75rem] text-ink-3 tabular-nums`,children:e.proposed?`·`:e.count}),selected:!d&&(F===`c:${e.id}`||V.data?.category.id===e.id),onPick:()=>q(`c:${e.id}`)},e.id))}):null,(0,$.jsx)(Yt,{groups:O,current:d?void 0:L?.id,onPick:e=>q(`s:${e}`)})]}):(0,$.jsx)(Qe,{children:(0,$.jsx)(Yt,{groups:D,current:J,onPick:K})}),o&&(y===`info`||y===`knowledge`)?(0,$.jsxs)(Bt,{project:o,group:y,children:[y===`knowledge`?R?R.startsWith(`p:`)?(0,$.jsx)(ge,{pageId:R.slice(2),onGone:()=>q(`all`),onOpen:q},R):R.startsWith(`t:`)?(0,$.jsx)(he,{tableId:R.slice(2),onGone:()=>q(`all`)},R):(0,$.jsx)(yt,{projectId:o.id,fileId:R.slice(2),readOnly:o.readOnly,onGone:()=>q(`all`)},R):B.data?L?(0,$.jsx)(Y,{title:L.label(),hint:L.hint?.(),plain:!0,children:(0,$.jsx)(Ue,{of:L,children:(0,$.jsx)(L.component,{})})},F):F?.startsWith(`c:`)?H?(0,$.jsxs)(`div`,{className:`flex flex-col gap-5`,children:[(0,$.jsx)(pe,{projectId:o.id,category:H,readOnly:o.readOnly,onOpen:q,onGone:()=>q(`all`)}),H.type===`choice`?null:(0,$.jsx)(xe,{projectId:o.id,category:H,categories:B.data.categories,onOpen:q})]},F):null:F?.startsWith(`v:`)?V.data?(0,$.jsx)(le,{value:V.data,readOnly:o.readOnly,children:(0,$.jsxs)(`div`,{className:`flex flex-col gap-2`,children:[V.data.items.length?(0,$.jsx)(`div`,{className:`flex flex-col rounded-xl bg-card p-1.5 shadow-soft ring-1 ring-border-soft`,children:V.data.items.map(e=>(0,$.jsx)(fe,{item:e,categories:B.data.categories.filter(e=>e.id!==V.data?.category.id),onOpen:q},e.key))}):null,V.data.rows.map(e=>(0,$.jsx)(`button`,{type:`button`,onClick:()=>q(`t:${e.tableId}`),className:`px-1 text-left text-[0.8125rem] text-ink-3 hover:text-ink`,children:f(`know.tocRows`,{n:e.count,table:e.title})},e.tableId))]})},F):null:(0,$.jsx)(X,{id:`documents`,children:(0,$.jsx)(ye,{projectId:o.id,data:B.data,readOnly:o.readOnly,onOpen:q})}):null:null,y===`info`?Ee(O):null]},o.id):null,o&&y===`data`?(0,$.jsx)(`div`,{className:`flex flex-col gap-9 pb-20`,children:F?.startsWith(`t:`)?(0,$.jsx)(he,{tableId:F.slice(2),onGone:()=>q(`all`)},F):F?.startsWith(`p:`)?(0,$.jsx)(ge,{pageId:F.slice(2),onGone:()=>q(`all`)},F):(0,$.jsxs)($.Fragment,{children:[z.data?(0,$.jsx)(ve,{projectId:o.id,data:z.data,readOnly:o.readOnly,onOpen:q}):null,Ee(O)]})}):null,o&&y===`results`?(0,$.jsxs)(`div`,{className:`flex flex-col gap-9 pb-20`,children:[N.data?(0,$.jsx)(Wt,{data:N.data,wizardId:A,filter:j,onFilter:M}):null,N.isError?(0,$.jsx)(`p`,{className:`text-[0.875rem] text-rose`,children:N.error.message}):null,Ee(O)]}):null,o||c?null:(0,$.jsx)(ce,{children:f(`settings.noProject`)})]}):null]})})})}export{Xt as ProjectPage};
@@ -1 +1 @@
1
- import{r as e}from"./rolldown-runtime-hePW80VL.js";import{n as t,t as n}from"./jsx-runtime-BNakU3Ej.js";import{r}from"./logo-C4V2_3Ar.js";import{Ct as i,Tt as a,a as o,cn as s,ct as c,f as l,fn as u,in as d,l as f,mt as p,nt as m,pn as h,rt as g,tn as _,yt as v}from"./ui-FW7ypPI6.js";import{a as y,i as b,n as x,o as S,r as C,s as w,t as T}from"./ChatView-NuMTv2_v.js";import{c as E,i as D,r as O,t as k}from"./brand-DIKyySmf.js";import{t as A}from"./RunnerView-B1GivAFs.js";import{a as j,n as M,o as N}from"./index-cEhTXa2U.js";var P={name:`bookmark`,size:24,node:[[`path`,{d:`M17 3a2 2 0 0 1 2 2v15a1 1 0 0 1-1.496.868l-4.512-2.578a2 2 0 0 0-1.984 0l-4.512 2.578A1 1 0 0 1 5 20V5a2 2 0 0 1 2-2z`,key:`oz39mx`}]]};P.node;var ee=d(P),F={name:`smartphone`,size:24,node:[[`rect`,{width:`14`,height:`20`,x:`5`,y:`2`,rx:`2`,ry:`2`,key:`1yt0o3`}],[`path`,{d:`M12 18h.01`,key:`mhygvu`}]]};F.node;var te=d(F),I={name:`square-plus`,size:24,node:[[`rect`,{width:`18`,height:`18`,x:`3`,y:`3`,rx:`2`,key:`afitv7`}],[`path`,{d:`M8 12h8`,key:`1wcyev`}],[`path`,{d:`M12 8v8`,key:`napkw2`}]],aliases:[`plus-square`]};I.node;var L=d(I),R=e(t(),1);function z(){if(window.self===window.top)return null;let e=new URLSearchParams(window.location.search).get(`embed`);return e===`inline`||e===`modal`||e===`popout`?e:null}var B=z(),ne=B?new URLSearchParams(window.location.search).get(`page`):null,V=(e,t={})=>window.parent.postMessage({type:`engenty-wizard:${e}`,...t},`*`),re=()=>V(`close`);function ie(e){(0,R.useEffect)(()=>{if(B===`inline`&&!e){let e=document.documentElement;document.getElementById(`root`)?.style.setProperty(`min-height`,`0`),e.style.overflow=`hidden`;let t=new ResizeObserver(()=>V(`height`,{height:Math.ceil(e.getBoundingClientRect().height)}));return t.observe(e),()=>t.disconnect()}if(B===`modal`||B===`popout`){let e=e=>{e.key===`Escape`&&!document.querySelector(`dialog[open]`)&&V(`close`)};return window.addEventListener(`keydown`,e),()=>window.removeEventListener(`keydown`,e)}},[e])}var H=e(n(),1);function U(e){(0,R.useEffect)(()=>{if(!e)return;let t=document.documentElement;return t.style.setProperty(`--raw-primary`,e),()=>{t.style.removeProperty(`--raw-primary`)}},[e])}function W(e,t){(0,R.useEffect)(()=>{if(!e||!t)return;let n=l(`/api/public/wizards/${e}`),r=[{rel:`manifest`,href:`${n}/manifest.webmanifest`},{rel:`apple-touch-icon`,href:`${n}/icons/apple-touch-icon.png`},{rel:`icon`,href:`${n}/icons/favicon.png`,type:`image/png`}].flatMap(({rel:e,href:t,type:n})=>{let r=document.querySelector(`link[rel="${e}"]`);if(!r)return[];let i={href:r.getAttribute(`href`),type:r.getAttribute(`type`)};return r.setAttribute(`href`,t),n&&r.setAttribute(`type`,n),[{link:r,before:i}]}),i=document.createElement(`meta`);return i.name=`apple-mobile-web-app-title`,i.content=t,document.head.appendChild(i),()=>{for(let{link:e,before:t}of r)for(let[n,r]of Object.entries(t))r===null?e.removeAttribute(n):e.setAttribute(n,r);i.remove()}},[e,t])}var G=/iPhone|iPad|iPod/.test(navigator.userAgent)||navigator.platform===`MacIntel`&&navigator.maxTouchPoints>1,K=G||/Android/.test(navigator.userAgent);function q(){let[e,t]=(0,R.useState)(()=>window.wizardInstall??null),[n,r]=(0,R.useState)(!1);if((0,R.useEffect)(()=>{let e=()=>t(window.wizardInstall??null);return window.addEventListener(`wizard-install`,e),()=>window.removeEventListener(`wizard-install`,e)},[]),window.matchMedia(`(display-mode: standalone)`).matches||navigator.standalone===!0||K&&!e&&!G)return null;let a=/Mac/.test(navigator.platform),o=i(K?`install.ios`:a?`install.bookmark.mac`:`install.bookmark.pc`);return(0,H.jsxs)(`div`,{className:`mt-6 flex flex-col items-center gap-2 text-[0.8125rem] text-ink-3`,children:[(0,H.jsxs)(`button`,{type:`button`,onClick:()=>{K&&e?(e.prompt(),window.wizardInstall=null,t(null)):r(e=>!e)},className:`inline-flex items-center gap-1.5 underline-offset-4 hover:text-ink hover:underline coarse:min-h-11`,children:[K?(0,H.jsx)(L,{className:`size-4`}):(0,H.jsx)(ee,{className:`size-4`}),i(K?`install.add`:`install.bookmark`)]}),n?(0,H.jsx)(`p`,{className:`max-w-xs leading-relaxed`,children:o}):null]})}function J({brand:e,toggle:t=!0}){return(0,H.jsx)(`header`,{className:`safe-top`,children:(0,H.jsxs)(`div`,{className:`relative flex h-14 items-center justify-center px-5`,children:[e.logoUrl?(0,H.jsx)(`img`,{src:l(e.logoUrl),alt:e.name,className:`h-7 max-w-[160px] object-contain`}):e.name?(0,H.jsx)(`span`,{className:`max-w-[60%] truncate font-display font-semibold text-[0.9375rem] text-ink-2 tracking-tight`,children:e.name}):null,t?(0,H.jsx)(`div`,{className:`absolute right-3`,children:(0,H.jsx)(D,{})}):null]})})}function Y({siteKey:e,onToken:t}){let n=(0,R.useRef)(null);return(0,R.useEffect)(()=>{let r=()=>{n.current&&window.turnstile&&!n.current.childElementCount&&window.turnstile.render(n.current,{sitekey:e,callback:t,appearance:`interaction-only`})};if(window.turnstile){r();return}let i=document.createElement(`script`);i.src=`https://challenges.cloudflare.com/turnstile/v0/api.js`,i.async=!0,i.onload=r,document.head.appendChild(i)},[e,t]),(0,H.jsx)(`div`,{ref:n,className:`mt-4 flex justify-center`})}function ae({token:e}){return!/iPhone|iPad|iPod|Android/.test(navigator.userAgent)||M||B?null:(0,H.jsxs)(`a`,{href:j(`${window.location.origin}${f}/w/${e}`),className:`mt-3 inline-flex items-center gap-1.5 text-[0.8125rem] text-ink-3 underline-offset-4 hover:text-ink hover:underline coarse:min-h-11`,children:[(0,H.jsx)(te,{className:`size-4`}),` `,i(`install.app`)]})}var X=e=>`wz.run.${e}`,Z=M&&new URLSearchParams(window.location.search).get(`start`)===`1`,Q=B===`inline`?`min-h-80`:`min-h-dvh`;function $(e,t){let n=u(),[r,i]=(0,R.useState)(!1),[a,s]=(0,R.useState)(null),[c,l]=(0,R.useState)(null),d=(()=>{try{return localStorage.getItem(X(e.token))}catch{return null}})();return{busy:r,error:a,captcha:c,setCaptcha:l,start:async()=>{i(!0),s(null);try{let{runId:r}=await o.post(`/api/public/wizards/${e.token}/runs`,{turnstileToken:c??void 0,embedded:B!==null,origin:ne??void 0});try{localStorage.setItem(X(e.token),r)}catch{}n(`${t}/${r}`,{replace:Z})}catch(e){s(e.message),i(!1)}},resume:d?()=>n(`${t}/${d}`):null}}function oe({wizard:e}){let{busy:t,error:n,captcha:r,setCaptcha:a,start:o,resume:s}=$(e,`/w/${e.token}`),c=Z&&e.available&&!e.turnstileSiteKey,l=(0,R.useRef)(!1);return(0,R.useEffect)(()=>{c&&!l.current&&(l.current=!0,o())},[c]),c&&!n?(0,H.jsx)(`div`,{className:`flex min-h-[60dvh] items-center justify-center text-ink-4`,children:(0,H.jsx)(p,{})}):(0,H.jsxs)(`div`,{className:`mx-auto flex max-w-lg animate-rise flex-col items-center px-6 pt-6 pb-12 text-center sm:pt-16 sm:pb-16`,children:[(0,H.jsx)(O,{kind:e.avatar,size:190,fluffy:!0}),(0,H.jsx)(`h1`,{className:`mt-2 text-balance font-display font-semibold text-[1.875rem] leading-[1.1] tracking-tight sm:text-[2.125rem]`,children:e.title}),e.description?(0,H.jsx)(`p`,{className:`mt-3 text-[1rem] text-ink-2 leading-relaxed`,children:e.description}):null,e.available?(0,H.jsxs)(H.Fragment,{children:[(0,H.jsxs)(g,{size:`lg`,className:`mt-10 min-w-48`,busy:t,disabled:!!e.turnstileSiteKey&&!r,onClick:o,children:[i(`run.start`),` `,(0,H.jsx)(_,{className:`size-4`})]}),e.turnstileSiteKey?(0,H.jsx)(Y,{siteKey:e.turnstileSiteKey,onToken:a}):null,s?(0,H.jsx)(`button`,{type:`button`,onClick:s,className:`mt-4 text-[0.875rem] text-ink-3 underline-offset-4 hover:text-ink hover:underline coarse:min-h-11`,children:i(`run.resume`)}):null,(0,H.jsx)(se,{wizard:e,current:`steps`}),B||M?null:(0,H.jsx)(q,{}),(0,H.jsx)(ae,{token:e.token})]}):(0,H.jsx)(`p`,{className:`mt-10 rounded-xl bg-paper-2 px-5 py-4 text-[0.9375rem] text-ink-2`,children:e.unavailableReason??i(`run.unavailable`)}),n?(0,H.jsx)(`p`,{className:`mt-4 text-[0.875rem] text-rose`,children:n}):null]})}function se({wizard:e,current:t}){let n=e.runners.filter(e=>e.id!==t&&e.kind===`page`&&e.url);return n.length?(0,H.jsx)(`p`,{className:`mt-4 flex flex-wrap justify-center gap-x-4 text-[0.875rem] text-ink-3`,children:n.map(e=>(0,H.jsx)(`a`,{href:e.url??void 0,className:`underline-offset-4 hover:text-ink hover:underline coarse:min-h-11`,children:i(`run.orAs`,{label:e.label})},e.id))}):null}function ce({wizard:e}){let t=w();return(0,H.jsx)(`header`,{className:`safe-top shrink-0 border-border-soft border-b`,children:(0,H.jsxs)(`div`,{className:`mx-auto flex h-16 w-full max-w-[760px] items-center gap-3 pr-2 pl-4 sm:pr-4 sm:pl-6`,children:[(0,H.jsx)(`span`,{className:v(t?.speaking&&`animate-breathe`),children:(0,H.jsx)(O,{kind:e.avatar,size:38})}),(0,H.jsxs)(`div`,{className:`min-w-0 flex-1`,children:[(0,H.jsx)(`div`,{className:`truncate font-display font-semibold text-[1rem] leading-tight tracking-tight`,children:e.title}),e.brand.name?(0,H.jsx)(`div`,{className:`truncate text-[0.75rem] text-ink-3`,children:e.brand.name}):null]}),e.brand.logoUrl&&B!==`popout`?(0,H.jsx)(`img`,{src:l(e.brand.logoUrl),alt:e.brand.name,className:`h-6 max-w-[120px] object-contain max-sm:hidden`}):null,B?null:(0,H.jsx)(D,{}),B===`popout`?(0,H.jsx)(c,{label:i(`common.close`),onClick:re,children:(0,H.jsx)(a,{className:`size-5`})}):null]})})}function le({door:e,wizard:t,header:n,footer:r}){let{busy:a,error:o,captcha:s,setCaptcha:c,start:l,resume:u}=$(t,`/w/${t.token}/${e}`),d=[{key:`hello`,who:`bot`,node:t.description||t.title}];return e!==`chat`&&d.push({key:e,who:`bot`,node:i(e===`video`?`video.hint`:`talk.joinHint`)}),t.available||d.push({key:`unavailable`,who:`bot`,node:t.unavailableReason??i(`run.unavailable`)}),o&&d.push({key:`error`,who:`bot`,node:o,tone:`error`}),t.available&&d.push(S(`start`,(0,H.jsxs)(H.Fragment,{children:[(0,H.jsxs)(b,{primary:!0,busy:a,disabled:!!t.turnstileSiteKey&&!s,onClick:()=>void l(),children:[i(`run.start`),` `,(0,H.jsx)(_,{className:`size-4`})]}),u?(0,H.jsx)(b,{onClick:u,children:i(`run.resume`)}):null,t.turnstileSiteKey?(0,H.jsx)(Y,{siteKey:t.turnstileSiteKey,onToken:c}):null]}))),(0,H.jsxs)(x,{header:n,footer:r,children:[(0,H.jsx)(y,{avatar:t.avatar,lines:d}),(0,H.jsx)(C,{})]})}function ue({className:e}){return(0,H.jsx)(`footer`,{className:v(`text-center text-ink-4`,e),children:(0,H.jsx)(`a`,{href:`${f}/`,target:B?`_blank`:void 0,rel:`noreferrer`,className:`inline-block hover:text-ink-2`,children:i(`run.madeWith`).replace(`engenty wizards`,k.name)})})}function de({chat:e=!1,steps:t=!1,talk:n=!1,video:a=!1}){let{token:c,runId:l}=h(),d=u(),_=r({queryKey:[`public`,c],queryFn:()=>o.get(`/api/public/wizards/${c}`),retry:(e,t)=>m(t)&&e<3}),y=_.data?.runners??[],b=!_.data||y.some(e=>e.id===`talk`),x=!_.data||y.some(e=>e.id===`video`),S=!_.data||y.some(e=>e.id===`chat`)||n&&b||a&&x,C=y[0]?.id,w=e||B===`popout`||!t&&!l&&S&&(C===`chat`||C===`talk`||C===`video`),D=a&&x||!t&&!e&&!n&&C===`video`,j=!D&&(n&&b||!t&&!e&&C===`talk`),P=D?`video`:j?`talk`:`chat`;if(U(_.data?.brand.accent),E(_.data?.avatar),W(c,_.data?.title),ie(w),(0,R.useEffect)(()=>{_.data&&(document.title=_.data.title)},[_.data]),(0,R.useEffect)(()=>{c&&l&&N(`run`,{token:c,runId:l})},[c,l]),_.isLoading)return(0,H.jsx)(`div`,{className:v(`flex items-center justify-center text-ink-4`,Q),children:(0,H.jsx)(p,{})});if(e&&_.data&&!S||n&&_.data&&!b||a&&_.data&&!x)return(0,H.jsx)(s,{to:`/w/${c}`,replace:!0});if(!_.data){let e=m(_.error);return(0,H.jsxs)(`div`,{className:v(`flex flex-col items-center justify-center gap-4 px-6 text-center`,Q),children:[(0,H.jsx)(O,{kind:`pebble`,size:80}),(0,H.jsx)(`p`,{className:`max-w-xs text-ink-3`,children:i(e?`common.offline`:`run.notFound`)}),e?(0,H.jsx)(g,{variant:`secondary`,onClick:()=>void _.refetch(),children:i(`common.retry`)}):null]})}if(w){let e=(0,H.jsx)(ce,{wizard:_.data}),t=M?(0,H.jsx)(`div`,{className:`safe-bottom`}):(0,H.jsx)(ue,{className:`pb-[max(0.375rem,env(safe-area-inset-bottom))] text-[0.6875rem]`});return(0,H.jsx)(`div`,{className:`flex h-dvh flex-col`,children:l?(0,H.jsx)(T,{runId:l,talk:j,call:D?`video`:j?`audio`:!1,onRestart:()=>d(`/w/${c}/${P}`),header:D||j?void 0:e,footer:t}):(0,H.jsx)(le,{wizard:_.data,header:e,footer:t,door:P})})}return(0,H.jsxs)(`div`,{className:v(`flex flex-col`,Q),children:[B===`inline`||M?null:(0,H.jsx)(J,{brand:_.data.brand,toggle:!B}),(0,H.jsx)(`div`,{className:`flex-1`,children:l?(0,H.jsx)(A,{runId:l,onRestart:()=>d(`/w/${c}`)}):(0,H.jsx)(oe,{wizard:_.data})}),M?(0,H.jsx)(`div`,{className:`safe-bottom`}):(0,H.jsx)(`footer`,{className:`safe-bottom pt-6 text-center text-[0.75rem] text-ink-4`,children:(0,H.jsx)(`a`,{href:`${f}/`,target:B?`_blank`:void 0,rel:`noreferrer`,className:`inline-block py-3.5 hover:text-ink-2`,children:i(`run.madeWith`).replace(`engenty wizards`,k.name)})})]})}export{J as BrandHeader,de as PublicRunner,U as useBrandAccent};
1
+ import{r as e}from"./rolldown-runtime-hePW80VL.js";import{n as t,t as n}from"./jsx-runtime-BNakU3Ej.js";import{r}from"./logo-C4V2_3Ar.js";import{Ct as i,Tt as a,a as o,cn as s,ct as c,f as l,fn as u,in as d,l as f,mt as p,nt as m,pn as h,rt as g,tn as _,yt as v}from"./ui-SKtUMhUq.js";import{a as y,i as b,n as x,o as S,r as C,s as w,t as T}from"./ChatView-3ESCXBad.js";import{c as E,i as D,r as O,t as k}from"./brand-ClxXyg-d.js";import{t as A}from"./RunnerView-Dzz0vC_M.js";import{a as j,n as M,o as N}from"./index-CsKV2ZNO.js";var P={name:`bookmark`,size:24,node:[[`path`,{d:`M17 3a2 2 0 0 1 2 2v15a1 1 0 0 1-1.496.868l-4.512-2.578a2 2 0 0 0-1.984 0l-4.512 2.578A1 1 0 0 1 5 20V5a2 2 0 0 1 2-2z`,key:`oz39mx`}]]};P.node;var ee=d(P),F={name:`smartphone`,size:24,node:[[`rect`,{width:`14`,height:`20`,x:`5`,y:`2`,rx:`2`,ry:`2`,key:`1yt0o3`}],[`path`,{d:`M12 18h.01`,key:`mhygvu`}]]};F.node;var te=d(F),I={name:`square-plus`,size:24,node:[[`rect`,{width:`18`,height:`18`,x:`3`,y:`3`,rx:`2`,key:`afitv7`}],[`path`,{d:`M8 12h8`,key:`1wcyev`}],[`path`,{d:`M12 8v8`,key:`napkw2`}]],aliases:[`plus-square`]};I.node;var L=d(I),R=e(t(),1);function z(){if(window.self===window.top)return null;let e=new URLSearchParams(window.location.search).get(`embed`);return e===`inline`||e===`modal`||e===`popout`?e:null}var B=z(),ne=B?new URLSearchParams(window.location.search).get(`page`):null,V=(e,t={})=>window.parent.postMessage({type:`engenty-wizard:${e}`,...t},`*`),re=()=>V(`close`);function ie(e){(0,R.useEffect)(()=>{if(B===`inline`&&!e){let e=document.documentElement;document.getElementById(`root`)?.style.setProperty(`min-height`,`0`),e.style.overflow=`hidden`;let t=new ResizeObserver(()=>V(`height`,{height:Math.ceil(e.getBoundingClientRect().height)}));return t.observe(e),()=>t.disconnect()}if(B===`modal`||B===`popout`){let e=e=>{e.key===`Escape`&&!document.querySelector(`dialog[open]`)&&V(`close`)};return window.addEventListener(`keydown`,e),()=>window.removeEventListener(`keydown`,e)}},[e])}var H=e(n(),1);function U(e){(0,R.useEffect)(()=>{if(!e)return;let t=document.documentElement;return t.style.setProperty(`--raw-primary`,e),()=>{t.style.removeProperty(`--raw-primary`)}},[e])}function W(e,t){(0,R.useEffect)(()=>{if(!e||!t)return;let n=l(`/api/public/wizards/${e}`),r=[{rel:`manifest`,href:`${n}/manifest.webmanifest`},{rel:`apple-touch-icon`,href:`${n}/icons/apple-touch-icon.png`},{rel:`icon`,href:`${n}/icons/favicon.png`,type:`image/png`}].flatMap(({rel:e,href:t,type:n})=>{let r=document.querySelector(`link[rel="${e}"]`);if(!r)return[];let i={href:r.getAttribute(`href`),type:r.getAttribute(`type`)};return r.setAttribute(`href`,t),n&&r.setAttribute(`type`,n),[{link:r,before:i}]}),i=document.createElement(`meta`);return i.name=`apple-mobile-web-app-title`,i.content=t,document.head.appendChild(i),()=>{for(let{link:e,before:t}of r)for(let[n,r]of Object.entries(t))r===null?e.removeAttribute(n):e.setAttribute(n,r);i.remove()}},[e,t])}var G=/iPhone|iPad|iPod/.test(navigator.userAgent)||navigator.platform===`MacIntel`&&navigator.maxTouchPoints>1,K=G||/Android/.test(navigator.userAgent);function q(){let[e,t]=(0,R.useState)(()=>window.wizardInstall??null),[n,r]=(0,R.useState)(!1);if((0,R.useEffect)(()=>{let e=()=>t(window.wizardInstall??null);return window.addEventListener(`wizard-install`,e),()=>window.removeEventListener(`wizard-install`,e)},[]),window.matchMedia(`(display-mode: standalone)`).matches||navigator.standalone===!0||K&&!e&&!G)return null;let a=/Mac/.test(navigator.platform),o=i(K?`install.ios`:a?`install.bookmark.mac`:`install.bookmark.pc`);return(0,H.jsxs)(`div`,{className:`mt-6 flex flex-col items-center gap-2 text-[0.8125rem] text-ink-3`,children:[(0,H.jsxs)(`button`,{type:`button`,onClick:()=>{K&&e?(e.prompt(),window.wizardInstall=null,t(null)):r(e=>!e)},className:`inline-flex items-center gap-1.5 underline-offset-4 hover:text-ink hover:underline coarse:min-h-11`,children:[K?(0,H.jsx)(L,{className:`size-4`}):(0,H.jsx)(ee,{className:`size-4`}),i(K?`install.add`:`install.bookmark`)]}),n?(0,H.jsx)(`p`,{className:`max-w-xs leading-relaxed`,children:o}):null]})}function J({brand:e,toggle:t=!0}){return(0,H.jsx)(`header`,{className:`safe-top`,children:(0,H.jsxs)(`div`,{className:`relative flex h-14 items-center justify-center px-5`,children:[e.logoUrl?(0,H.jsx)(`img`,{src:l(e.logoUrl),alt:e.name,className:`h-7 max-w-[160px] object-contain`}):e.name?(0,H.jsx)(`span`,{className:`max-w-[60%] truncate font-display font-semibold text-[0.9375rem] text-ink-2 tracking-tight`,children:e.name}):null,t?(0,H.jsx)(`div`,{className:`absolute right-3`,children:(0,H.jsx)(D,{})}):null]})})}function Y({siteKey:e,onToken:t}){let n=(0,R.useRef)(null);return(0,R.useEffect)(()=>{let r=()=>{n.current&&window.turnstile&&!n.current.childElementCount&&window.turnstile.render(n.current,{sitekey:e,callback:t,appearance:`interaction-only`})};if(window.turnstile){r();return}let i=document.createElement(`script`);i.src=`https://challenges.cloudflare.com/turnstile/v0/api.js`,i.async=!0,i.onload=r,document.head.appendChild(i)},[e,t]),(0,H.jsx)(`div`,{ref:n,className:`mt-4 flex justify-center`})}function ae({token:e}){return!/iPhone|iPad|iPod|Android/.test(navigator.userAgent)||M||B?null:(0,H.jsxs)(`a`,{href:j(`${window.location.origin}${f}/w/${e}`),className:`mt-3 inline-flex items-center gap-1.5 text-[0.8125rem] text-ink-3 underline-offset-4 hover:text-ink hover:underline coarse:min-h-11`,children:[(0,H.jsx)(te,{className:`size-4`}),` `,i(`install.app`)]})}var X=e=>`wz.run.${e}`,Z=M&&new URLSearchParams(window.location.search).get(`start`)===`1`,Q=B===`inline`?`min-h-80`:`min-h-dvh`;function $(e,t){let n=u(),[r,i]=(0,R.useState)(!1),[a,s]=(0,R.useState)(null),[c,l]=(0,R.useState)(null),d=(()=>{try{return localStorage.getItem(X(e.token))}catch{return null}})();return{busy:r,error:a,captcha:c,setCaptcha:l,start:async()=>{i(!0),s(null);try{let{runId:r}=await o.post(`/api/public/wizards/${e.token}/runs`,{turnstileToken:c??void 0,embedded:B!==null,origin:ne??void 0});try{localStorage.setItem(X(e.token),r)}catch{}n(`${t}/${r}`,{replace:Z})}catch(e){s(e.message),i(!1)}},resume:d?()=>n(`${t}/${d}`):null}}function oe({wizard:e}){let{busy:t,error:n,captcha:r,setCaptcha:a,start:o,resume:s}=$(e,`/w/${e.token}`),c=Z&&e.available&&!e.turnstileSiteKey,l=(0,R.useRef)(!1);return(0,R.useEffect)(()=>{c&&!l.current&&(l.current=!0,o())},[c]),c&&!n?(0,H.jsx)(`div`,{className:`flex min-h-[60dvh] items-center justify-center text-ink-4`,children:(0,H.jsx)(p,{})}):(0,H.jsxs)(`div`,{className:`mx-auto flex max-w-lg animate-rise flex-col items-center px-6 pt-6 pb-12 text-center sm:pt-16 sm:pb-16`,children:[(0,H.jsx)(O,{kind:e.avatar,size:190,fluffy:!0}),(0,H.jsx)(`h1`,{className:`mt-2 text-balance font-display font-semibold text-[1.875rem] leading-[1.1] tracking-tight sm:text-[2.125rem]`,children:e.title}),e.description?(0,H.jsx)(`p`,{className:`mt-3 text-[1rem] text-ink-2 leading-relaxed`,children:e.description}):null,e.available?(0,H.jsxs)(H.Fragment,{children:[(0,H.jsxs)(g,{size:`lg`,className:`mt-10 min-w-48`,busy:t,disabled:!!e.turnstileSiteKey&&!r,onClick:o,children:[i(`run.start`),` `,(0,H.jsx)(_,{className:`size-4`})]}),e.turnstileSiteKey?(0,H.jsx)(Y,{siteKey:e.turnstileSiteKey,onToken:a}):null,s?(0,H.jsx)(`button`,{type:`button`,onClick:s,className:`mt-4 text-[0.875rem] text-ink-3 underline-offset-4 hover:text-ink hover:underline coarse:min-h-11`,children:i(`run.resume`)}):null,(0,H.jsx)(se,{wizard:e,current:`steps`}),B||M?null:(0,H.jsx)(q,{}),(0,H.jsx)(ae,{token:e.token})]}):(0,H.jsx)(`p`,{className:`mt-10 rounded-xl bg-paper-2 px-5 py-4 text-[0.9375rem] text-ink-2`,children:e.unavailableReason??i(`run.unavailable`)}),n?(0,H.jsx)(`p`,{className:`mt-4 text-[0.875rem] text-rose`,children:n}):null]})}function se({wizard:e,current:t}){let n=e.runners.filter(e=>e.id!==t&&e.kind===`page`&&e.url);return n.length?(0,H.jsx)(`p`,{className:`mt-4 flex flex-wrap justify-center gap-x-4 text-[0.875rem] text-ink-3`,children:n.map(e=>(0,H.jsx)(`a`,{href:e.url??void 0,className:`underline-offset-4 hover:text-ink hover:underline coarse:min-h-11`,children:i(`run.orAs`,{label:e.label})},e.id))}):null}function ce({wizard:e}){let t=w();return(0,H.jsx)(`header`,{className:`safe-top shrink-0 border-border-soft border-b`,children:(0,H.jsxs)(`div`,{className:`mx-auto flex h-16 w-full max-w-[760px] items-center gap-3 pr-2 pl-4 sm:pr-4 sm:pl-6`,children:[(0,H.jsx)(`span`,{className:v(t?.speaking&&`animate-breathe`),children:(0,H.jsx)(O,{kind:e.avatar,size:38})}),(0,H.jsxs)(`div`,{className:`min-w-0 flex-1`,children:[(0,H.jsx)(`div`,{className:`truncate font-display font-semibold text-[1rem] leading-tight tracking-tight`,children:e.title}),e.brand.name?(0,H.jsx)(`div`,{className:`truncate text-[0.75rem] text-ink-3`,children:e.brand.name}):null]}),e.brand.logoUrl&&B!==`popout`?(0,H.jsx)(`img`,{src:l(e.brand.logoUrl),alt:e.brand.name,className:`h-6 max-w-[120px] object-contain max-sm:hidden`}):null,B?null:(0,H.jsx)(D,{}),B===`popout`?(0,H.jsx)(c,{label:i(`common.close`),onClick:re,children:(0,H.jsx)(a,{className:`size-5`})}):null]})})}function le({door:e,wizard:t,header:n,footer:r}){let{busy:a,error:o,captcha:s,setCaptcha:c,start:l,resume:u}=$(t,`/w/${t.token}/${e}`),d=[{key:`hello`,who:`bot`,node:t.description||t.title}];return e!==`chat`&&d.push({key:e,who:`bot`,node:i(e===`video`?`video.hint`:`talk.joinHint`)}),t.available||d.push({key:`unavailable`,who:`bot`,node:t.unavailableReason??i(`run.unavailable`)}),o&&d.push({key:`error`,who:`bot`,node:o,tone:`error`}),t.available&&d.push(S(`start`,(0,H.jsxs)(H.Fragment,{children:[(0,H.jsxs)(b,{primary:!0,busy:a,disabled:!!t.turnstileSiteKey&&!s,onClick:()=>void l(),children:[i(`run.start`),` `,(0,H.jsx)(_,{className:`size-4`})]}),u?(0,H.jsx)(b,{onClick:u,children:i(`run.resume`)}):null,t.turnstileSiteKey?(0,H.jsx)(Y,{siteKey:t.turnstileSiteKey,onToken:c}):null]}))),(0,H.jsxs)(x,{header:n,footer:r,children:[(0,H.jsx)(y,{avatar:t.avatar,lines:d}),(0,H.jsx)(C,{})]})}function ue({className:e}){return(0,H.jsx)(`footer`,{className:v(`text-center text-ink-4`,e),children:(0,H.jsx)(`a`,{href:`${f}/`,target:B?`_blank`:void 0,rel:`noreferrer`,className:`inline-block hover:text-ink-2`,children:i(`run.madeWith`).replace(`engenty wizards`,k.name)})})}function de({chat:e=!1,steps:t=!1,talk:n=!1,video:a=!1}){let{token:c,runId:l}=h(),d=u(),_=r({queryKey:[`public`,c],queryFn:()=>o.get(`/api/public/wizards/${c}`),retry:(e,t)=>m(t)&&e<3}),y=_.data?.runners??[],b=!_.data||y.some(e=>e.id===`talk`),x=!_.data||y.some(e=>e.id===`video`),S=!_.data||y.some(e=>e.id===`chat`)||n&&b||a&&x,C=y[0]?.id,w=e||B===`popout`||!t&&!l&&S&&(C===`chat`||C===`talk`||C===`video`),D=a&&x||!t&&!e&&!n&&C===`video`,j=!D&&(n&&b||!t&&!e&&C===`talk`),P=D?`video`:j?`talk`:`chat`;if(U(_.data?.brand.accent),E(_.data?.avatar),W(c,_.data?.title),ie(w),(0,R.useEffect)(()=>{_.data&&(document.title=_.data.title)},[_.data]),(0,R.useEffect)(()=>{c&&l&&N(`run`,{token:c,runId:l})},[c,l]),_.isLoading)return(0,H.jsx)(`div`,{className:v(`flex items-center justify-center text-ink-4`,Q),children:(0,H.jsx)(p,{})});if(e&&_.data&&!S||n&&_.data&&!b||a&&_.data&&!x)return(0,H.jsx)(s,{to:`/w/${c}`,replace:!0});if(!_.data){let e=m(_.error);return(0,H.jsxs)(`div`,{className:v(`flex flex-col items-center justify-center gap-4 px-6 text-center`,Q),children:[(0,H.jsx)(O,{kind:`pebble`,size:80}),(0,H.jsx)(`p`,{className:`max-w-xs text-ink-3`,children:i(e?`common.offline`:`run.notFound`)}),e?(0,H.jsx)(g,{variant:`secondary`,onClick:()=>void _.refetch(),children:i(`common.retry`)}):null]})}if(w){let e=(0,H.jsx)(ce,{wizard:_.data}),t=M?(0,H.jsx)(`div`,{className:`safe-bottom`}):(0,H.jsx)(ue,{className:`pb-[max(0.375rem,env(safe-area-inset-bottom))] text-[0.6875rem]`});return(0,H.jsx)(`div`,{className:`flex h-dvh flex-col`,children:l?(0,H.jsx)(T,{runId:l,talk:j,call:D?`video`:j?`audio`:!1,onRestart:()=>d(`/w/${c}/${P}`),header:D||j?void 0:e,footer:t}):(0,H.jsx)(le,{wizard:_.data,header:e,footer:t,door:P})})}return(0,H.jsxs)(`div`,{className:v(`flex flex-col`,Q),children:[B===`inline`||M?null:(0,H.jsx)(J,{brand:_.data.brand,toggle:!B}),(0,H.jsx)(`div`,{className:`flex-1`,children:l?(0,H.jsx)(A,{runId:l,onRestart:()=>d(`/w/${c}`)}):(0,H.jsx)(oe,{wizard:_.data})}),M?(0,H.jsx)(`div`,{className:`safe-bottom`}):(0,H.jsx)(`footer`,{className:`safe-bottom pt-6 text-center text-[0.75rem] text-ink-4`,children:(0,H.jsx)(`a`,{href:`${f}/`,target:B?`_blank`:void 0,rel:`noreferrer`,className:`inline-block py-3.5 hover:text-ink-2`,children:i(`run.madeWith`).replace(`engenty wizards`,k.name)})})]})}export{J as BrandHeader,de as PublicRunner,U as useBrandAccent};
@@ -1 +1 @@
1
- import{r as e}from"./rolldown-runtime-hePW80VL.js";import{t}from"./jsx-runtime-BNakU3Ej.js";import{Ct as n,in as r}from"./ui-FW7ypPI6.js";import{t as i}from"./lock-BNvsUKTg.js";var a={name:`text-align-start`,size:24,node:[[`path`,{d:`M21 5H3`,key:`1fi0y6`}],[`path`,{d:`M15 12H3`,key:`6jk70r`}],[`path`,{d:`M17 19H3`,key:`z6ezky`}]],aliases:[`text`,`align-left`]};a.node;var o=r(a),s=e(t(),1);function c(e){return n(e.origin===`local`?`readonly.project`:`readonly.server`)}function l({children:e}){return(0,s.jsxs)(`div`,{className:`flex items-start gap-3 rounded-xl bg-paper-2 px-4 py-3 text-[0.875rem] text-ink-2 leading-relaxed`,children:[(0,s.jsx)(i,{className:`mt-0.5 size-4 shrink-0 text-ink-3`}),(0,s.jsx)(`p`,{className:`min-w-0`,children:e})]})}export{c as n,o as r,l as t};
1
+ import{r as e}from"./rolldown-runtime-hePW80VL.js";import{t}from"./jsx-runtime-BNakU3Ej.js";import{Ct as n,in as r}from"./ui-SKtUMhUq.js";import{t as i}from"./lock-D5tH2Lqc.js";var a={name:`text-align-start`,size:24,node:[[`path`,{d:`M21 5H3`,key:`1fi0y6`}],[`path`,{d:`M15 12H3`,key:`6jk70r`}],[`path`,{d:`M17 19H3`,key:`z6ezky`}]],aliases:[`text`,`align-left`]};a.node;var o=r(a),s=e(t(),1);function c(e){return n(e.origin===`local`?`readonly.project`:`readonly.server`)}function l({children:e}){return(0,s.jsxs)(`div`,{className:`flex items-start gap-3 rounded-xl bg-paper-2 px-4 py-3 text-[0.875rem] text-ink-2 leading-relaxed`,children:[(0,s.jsx)(i,{className:`mt-0.5 size-4 shrink-0 text-ink-3`}),(0,s.jsx)(`p`,{className:`min-w-0`,children:e})]})}export{c as n,o as r,l as t};
@@ -0,0 +1,4 @@
1
+ import{r as e}from"./rolldown-runtime-hePW80VL.js";import{n as t,t as n}from"./jsx-runtime-BNakU3Ej.js";import{O as r,r as i}from"./logo-C4V2_3Ar.js";import{d as a,u as o}from"./Marketplace-CmeAQDOY.js";import{t as s}from"./useMutation-DKyQXgyj.js";import{Bt as c,Ct as l,Dt as u,Lt as d,Mt as f,Nt as p,Qt as m,Tt as h,Ut as g,Yt as _,Zt as v,a as y,at as b,ct as x,ft as S,gt as C,in as w,it as T,lt as E,mt as D,ot as O,pt as k,rt as A,st as j,tt as M,ut as N,vt as P,xt as F,y as ee,yt as I}from"./ui-SKtUMhUq.js";import{t as te}from"./upload-hT54Sh8P.js";import{F as ne,I as re,M as L,P as R,at as ie,j as ae,k as oe}from"./index-CsKV2ZNO.js";var se={name:`calendar`,size:24,node:[[`path`,{d:`M8 2v3`,key:`1ioesn`}],[`path`,{d:`M16 2v3`,key:`otl347`}],[`rect`,{x:`3`,y:`3`,width:`18`,height:`18`,rx:`2`,key:`h1oib`}],[`path`,{d:`M3 9h18`,key:`1pudct`}]]};se.node;var z=w(se),ce={name:`files`,size:24,node:[[`path`,{d:`M15 2h-4a2 2 0 0 0-2 2v11a2 2 0 0 0 2 2h8a2 2 0 0 0 2-2V8`,key:`14sh0y`}],[`path`,{d:`M16.706 2.706A2.4 2.4 0 0 0 15 2v5a1 1 0 0 0 1 1h5a2.4 2.4 0 0 0-.706-1.706z`,key:`1970lx`}],[`path`,{d:`M5 7a2 2 0 0 0-2 2v11a2 2 0 0 0 2 2h8a2 2 0 0 0 1.732-1`,key:`l4dndm`}]]};ce.node;var le=w(ce),ue={name:`hash`,size:24,node:[[`line`,{x1:`4`,x2:`20`,y1:`9`,y2:`9`,key:`4lhtct`}],[`line`,{x1:`4`,x2:`20`,y1:`15`,y2:`15`,key:`vyu0kd`}],[`line`,{x1:`10`,x2:`8`,y1:`3`,y2:`21`,key:`1ggp8o`}],[`line`,{x1:`16`,x2:`14`,y1:`3`,y2:`21`,key:`weycgp`}]]};ue.node;var de=w(ue),B={name:`list-ordered`,size:24,node:[[`path`,{d:`M11 5h10`,key:`1cz7ny`}],[`path`,{d:`M11 12h10`,key:`1438ji`}],[`path`,{d:`M11 19h10`,key:`11t30w`}],[`path`,{d:`M4 4h1v5`,key:`10yrso`}],[`path`,{d:`M4 9h2`,key:`r1h2o0`}],[`path`,{d:`M6.5 20H3.4c0-1 2.6-1.925 2.6-3.5a1.5 1.5 0 0 0-2.6-1.02`,key:`xtkcd5`}]]};B.node;var fe=w(B),V={name:`messages-square`,size:24,node:[[`path`,{d:`M16 10a2 2 0 0 1-2 2H6.828a2 2 0 0 0-1.414.586l-2.202 2.202A.71.71 0 0 1 2 14.286V4a2 2 0 0 1 2-2h10a2 2 0 0 1 2 2z`,key:`1n2ejm`}],[`path`,{d:`M20 9a2 2 0 0 1 2 2v10.286a.71.71 0 0 1-1.212.502l-2.202-2.202A2 2 0 0 0 17.172 19H10a2 2 0 0 1-2-2v-1`,key:`1qfcsi`}]]};V.node;var pe=w(V),H={name:`tags`,size:24,node:[[`path`,{d:`M13.172 2a2 2 0 0 1 1.414.586l6.71 6.71a2.4 2.4 0 0 1 0 3.408l-4.592 4.592a2.4 2.4 0 0 1-3.408 0l-6.71-6.71A2 2 0 0 1 6 9.172V3a1 1 0 0 1 1-1z`,key:`16rjxf`}],[`path`,{d:`M2 7v6.172a2 2 0 0 0 .586 1.414l6.71 6.71a2.4 2.4 0 0 0 3.191.193`,key:`178nd4`}],[`circle`,{cx:`10.5`,cy:`6.5`,r:`.5`,fill:`currentColor`,key:`12ikhr`}]]};H.node;var me=w(H),he={name:`toggle-left`,size:24,node:[[`circle`,{cx:`9`,cy:`12`,r:`3`,key:`u3jwor`}],[`rect`,{width:`20`,height:`14`,x:`2`,y:`5`,rx:`7`,key:`g7kal2`}]]};he.node;var ge=w(he),U=e(t(),1),W=e(n(),1),G={choice:me,date:z,number:de,text:o,boolean:ge},K=e=>[`knowledge`,e];function _e(e){return e===1?l(`know.item`):l(`know.items`,{n:e})}function q(e,t){if(e.type===`boolean`||typeof t==`boolean`)return l(t?`know.yes`:`know.no`);if(e.type===`date`&&typeof t==`string`){let[e,n]=t.split(` `),r=new Date(`${e}T00:00:00`),i=Number.isNaN(r.getTime())?t:r.toLocaleDateString(F,{day:`2-digit`,month:`2-digit`,year:`numeric`});return n?`${i} ${n}`:i}return e.type===`number`&&typeof t==`number`?`${t.toLocaleString(F)}${e.unit?` ${e.unit}`:``}`:String(t)}function ve(e,t){return e.flatMap(e=>{let n=t.find(t=>t.categoryId===e.id);return n?e.type===`boolean`?n.values[0]===!0?[e.name]:[]:[n.values.map(t=>q(e,t)).join(`, `)]:[]}).join(` · `)}function ye({trigger:e,open:t,onOpen:n,children:r}){let i=(0,U.useRef)(null);return(0,U.useEffect)(()=>{if(!t)return;let e=e=>{i.current?.contains(e.target)||n(!1)},r=e=>e.key===`Escape`&&n(!1);return document.addEventListener(`mousedown`,e),document.addEventListener(`keydown`,r),()=>{document.removeEventListener(`mousedown`,e),document.removeEventListener(`keydown`,r)}},[t,n]),(0,W.jsxs)(`div`,{ref:i,className:`relative inline-flex`,children:[e,t?(0,W.jsx)(`div`,{className:`absolute top-full left-0 z-30 mt-1.5 w-72 max-w-[calc(100vw-32px)] rounded-xl bg-card p-3 shadow-overlay ring-1 ring-border-soft`,children:r}):null]})}function be({category:e,current:t,onSave:n}){let[r,i]=(0,U.useState)(t[0]===void 0?``:String(t[0]));if(e.type===`choice`){let a=t.map(String);return(0,W.jsxs)(`div`,{className:`flex flex-col gap-2.5`,children:[e.values.length?(0,W.jsx)(S,{multi:!0,value:a,options:e.values.map(e=>e.value),onChange:t=>n(e.multiple?t:t.filter(e=>!a.includes(e)).slice(0,1))}):null,(0,W.jsxs)(`form`,{className:`flex gap-2`,onSubmit:t=>{t.preventDefault(),r.trim()&&n(e.multiple?[...a,r.trim()]:[r.trim()])},children:[(0,W.jsx)(E,{"data-autofocus":!0,value:a.includes(r)?``:r,placeholder:l(`know.addValue`),onChange:e=>i(e.target.value),className:`h-9`}),(0,W.jsx)(x,{label:l(`know.addValue`),type:`submit`,children:(0,W.jsx)(p,{className:`size-4`})})]})]})}return e.type===`boolean`?(0,W.jsx)(S,{value:t[0]===!0?l(`know.yes`):t[0]===!1?l(`know.no`):``,options:[l(`know.yes`),l(`know.no`)],onChange:e=>n([e===l(`know.yes`)])}):(0,W.jsxs)(`form`,{className:`flex gap-2`,onSubmit:t=>{t.preventDefault(),n(r.trim()?[e.type===`number`?Number(r.replace(`,`,`.`)):r.trim()]:[])},children:[(0,W.jsx)(E,{"data-autofocus":!0,type:e.type===`date`?`date`:e.type===`number`?`number`:`text`,step:`any`,value:e.type===`date`?r.slice(0,10):r,onChange:e=>i(e.target.value),className:`h-9`}),(0,W.jsx)(A,{type:`submit`,size:`sm`,children:`OK`})]})}function xe({projectId:e,itemKey:t,has:n,categories:i,readOnly:a}){let o=r(),[c,u]=(0,U.useState)(null),[d,f]=(0,U.useState)(n);(0,U.useEffect)(()=>f(n),[n]);let m=s({mutationFn:({categoryId:n,next:r})=>y.put(`/api/studio/projects/${e}/items/${t}/categories/${n}`,{values:r}),onSuccess:()=>o.invalidateQueries({queryKey:K(e)})}),g=i.filter(e=>!(e.proposed||e.tableId)),_=(e,t)=>{f(n=>[...n.filter(t=>t.categoryId!==e.id),...t.length?[{categoryId:e.id,values:t,by:`person`}]:[]]),m.mutate({categoryId:e.id,next:t}),u(null)},v=g.filter(e=>d.some(t=>t.categoryId===e.id)),b=g.filter(e=>!d.some(t=>t.categoryId===e.id));return g.length?(0,W.jsxs)(`div`,{className:`flex flex-wrap items-center gap-1.5`,children:[v.map(e=>{let t=d.find(t=>t.categoryId===e.id),n=G[e.type],r=(0,W.jsxs)(`button`,{type:`button`,disabled:a,title:`${e.name} · ${l(`know.by.${t.by}`)}`,onClick:()=>u(c===e.id?null:e.id),className:`inline-flex h-7 items-center gap-1.5 rounded-full bg-paper-2 px-2.5 text-[0.75rem] text-ink-2 transition hover:bg-paper-3 hover:text-ink disabled:pointer-events-none`,children:[(0,W.jsx)(n,{className:`size-3.5 text-ink-3`}),(0,W.jsx)(`span`,{className:`text-ink-3`,children:e.name}),(0,W.jsx)(`span`,{className:`font-medium`,children:t.values.map(t=>q(e,t)).join(`, `)})]},e.id);return a?(0,W.jsx)(`span`,{children:r},e.id):(0,W.jsxs)(ye,{trigger:r,open:c===e.id,onOpen:t=>u(t?e.id:null),children:[(0,W.jsxs)(`div`,{className:`mb-2 flex items-center justify-between gap-2`,children:[(0,W.jsx)(`span`,{className:`font-medium text-[0.8125rem]`,children:e.name}),(0,W.jsx)(x,{label:l(`know.remove`),onClick:()=>_(e,[]),className:`size-7`,children:(0,W.jsx)(h,{className:`size-3.5`})})]}),(0,W.jsx)(be,{category:e,current:t.values,onSave:t=>_(e,t)})]},e.id)}),a||!b.length?null:(0,W.jsx)(ye,{open:c===`+`,onOpen:e=>u(e?`+`:null),trigger:(0,W.jsxs)(`button`,{type:`button`,onClick:()=>u(c===`+`?null:`+`),className:`inline-flex h-7 items-center gap-1 rounded-full px-2 text-[0.75rem] text-ink-3 ring-1 ring-border-soft transition hover:text-ink hover:ring-border`,children:[(0,W.jsx)(p,{className:`size-3.5`}),` `,l(`know.category`)]}),children:(0,W.jsx)(Se,{categories:b,onSave:_})})]}):null}function Se({categories:e,onSave:t}){let[n,r]=(0,U.useState)(e[0]?.id??``),i=e.find(e=>e.id===n);return(0,W.jsxs)(`div`,{className:`flex flex-col gap-2.5`,children:[(0,W.jsx)(k,{value:n,onChange:r,options:e.map(e=>({value:e.id,label:e.name}))}),i?(0,W.jsx)(be,{category:i,current:[],onSave:e=>t(i,e)},i.id):null]})}function Ce({projectId:e,open:t,onClose:n,onMade:i}){let a=r(),[o,c]=(0,U.useState)(``),[u,d]=(0,U.useState)(`choice`),[f,p]=(0,U.useState)(``),[m,h]=(0,U.useState)(!1),[g,_]=(0,U.useState)(!1),[v,b]=(0,U.useState)(``),[x,S]=(0,U.useState)(``),w=s({mutationFn:()=>y.post(`/api/studio/projects/${e}/categories`,{name:o.trim(),type:u,unit:u===`number`&&f.trim()||null,multiple:u===`choice`&&m,ordered:u===`choice`&&g,hint:x.trim()||null,values:u===`choice`?v.split(`
2
+ `).map(e=>e.trim()).filter(Boolean):void 0}),onSuccess:async({id:t})=>{await a.invalidateQueries({queryKey:K(e)}),c(``),b(``),S(``),i(t)}});return(0,W.jsx)(O,{open:t,onClose:n,title:l(`know.newCategory`),children:(0,W.jsxs)(`form`,{className:`flex flex-col gap-4`,onSubmit:e=>{e.preventDefault(),o.trim()&&w.mutate()},children:[(0,W.jsxs)(`div`,{children:[(0,W.jsx)(N,{children:l(`know.name`)}),(0,W.jsx)(E,{"data-autofocus":!0,value:o,maxLength:80,onChange:e=>c(e.target.value)})]}),(0,W.jsxs)(`div`,{children:[(0,W.jsx)(N,{children:l(`know.type`)}),(0,W.jsx)(k,{value:u,onChange:e=>d(e),options:[`choice`,`date`,`number`,`text`,`boolean`].map(e=>({value:e,label:l(`know.type.${e}`)}))})]}),u===`number`?(0,W.jsxs)(`div`,{children:[(0,W.jsx)(N,{hint:l(`know.unitHint`),children:l(`know.unit`)}),(0,W.jsx)(E,{value:f,maxLength:20,onChange:e=>p(e.target.value)})]}):null,u===`choice`?(0,W.jsxs)(W.Fragment,{children:[(0,W.jsxs)(`div`,{children:[(0,W.jsx)(N,{hint:l(`know.valuesHint`),children:l(`know.values`)}),(0,W.jsx)(P,{minRows:3,value:v,onChange:e=>b(e.target.value)})]}),(0,W.jsxs)(`label`,{className:`flex items-center justify-between gap-3 text-[0.875rem]`,children:[l(`know.multiple`),(0,W.jsx)(C,{checked:m,onChange:h})]}),(0,W.jsxs)(`label`,{className:`flex items-center justify-between gap-3 text-[0.875rem]`,children:[l(`know.ordered`),(0,W.jsx)(C,{checked:g,onChange:_})]})]}):null,(0,W.jsxs)(`div`,{children:[(0,W.jsx)(N,{hint:l(`know.hintFieldHint`),children:l(`know.hintField`)}),(0,W.jsx)(E,{value:x,maxLength:120,onChange:e=>S(e.target.value)})]}),w.error?(0,W.jsx)(`p`,{className:`text-[0.875rem] text-rose`,children:w.error.message}):null,(0,W.jsxs)(`div`,{className:`flex justify-end gap-2`,children:[(0,W.jsx)(A,{variant:`ghost`,onClick:n,children:l(`common.cancel`)}),(0,W.jsx)(A,{type:`submit`,busy:w.isPending,disabled:!o.trim(),children:l(`know.create`)})]})]})})}function we({projectId:e,category:t,readOnly:n,onOpen:i,onGone:a}){let o=r(),c=()=>o.invalidateQueries({queryKey:K(e)}),[d,f]=(0,U.useState)(``),m=s({mutationFn:e=>e(),onSuccess:c}),h=G[t.type],g=new Map(t.values.map(e=>[e.id,e]));return(0,W.jsxs)(L,{title:t.name,hint:[l(`know.type.${t.type}`),t.unit,t.hint].filter(Boolean).join(` · `),plain:!0,action:n?null:(0,W.jsx)(x,{label:l(`know.deleteCategory`),className:`hover:text-rose`,onClick:()=>confirm(l(`know.confirmCategory`,{name:t.name}))&&m.mutate(async()=>{await y.del(`/api/studio/categories/${t.id}`),a()}),children:(0,W.jsx)(u,{className:`size-4`})}),children:[t.proposed&&!n?(0,W.jsxs)(T,{className:`flex flex-wrap items-center gap-3 p-4`,children:[(0,W.jsx)(b,{tone:`ember`,children:l(`know.proposed`)}),(0,W.jsx)(`span`,{className:`flex-1 text-[0.875rem] text-ink-2`,children:l(`know.proposedHint`)}),(0,W.jsx)(A,{size:`sm`,onClick:()=>m.mutate(()=>y.patch(`/api/studio/categories/${t.id}`,{proposed:!1})),children:l(`know.accept`)})]}):null,t.alike.map(([e,t])=>{let r=g.get(e),i=g.get(t);if(!(r&&i))return null;let[a,o]=r.count<i.count?[r,i]:[i,r];return(0,W.jsxs)(T,{className:`flex flex-wrap items-center gap-3 p-4`,children:[(0,W.jsx)(`span`,{className:`flex-1 text-[0.875rem] text-ink-2`,children:l(`know.alike`,{a:a.value,b:o.value})}),n?null:(0,W.jsx)(A,{size:`sm`,variant:`secondary`,busy:m.isPending,onClick:()=>m.mutate(()=>y.post(`/api/studio/values/${a.id}/merge`,{into:o.id})),children:l(`know.merge`)})]},`${e}:${t}`)}),(0,W.jsxs)(T,{className:`flex flex-col p-1.5`,children:[t.type===`choice`?t.values.length?t.values.map(e=>(0,W.jsxs)(`button`,{type:`button`,onClick:()=>i(`v:${e.id}`),className:`flex items-center gap-3 rounded-lg px-3 py-2.5 text-left transition hover:bg-accent`,children:[(0,W.jsx)(h,{className:`size-4 shrink-0 text-ink-3`}),(0,W.jsx)(`span`,{className:`min-w-0 flex-1 truncate text-[0.875rem]`,children:e.value}),e.summary?(0,W.jsx)(b,{children:l(`know.summary`)}):null,(0,W.jsx)(`span`,{className:`shrink-0 text-[0.75rem] text-ink-3 tabular-nums`,children:_e(e.count)})]},e.id)):(0,W.jsx)(j,{children:l(`know.empty`)}):(0,W.jsxs)(`div`,{className:`flex items-center gap-3 px-3 py-2.5 text-[0.875rem]`,children:[(0,W.jsx)(h,{className:`size-4 shrink-0 text-ink-3`}),(0,W.jsx)(`span`,{className:`flex-1 text-ink-2`,children:t.range?l(`know.range`,{min:q(t,t.range.min),max:q(t,t.range.max)}):l(`know.unset`)}),(0,W.jsx)(`span`,{className:`text-[0.75rem] text-ink-3 tabular-nums`,children:_e(t.count)})]}),t.type===`choice`&&!n?(0,W.jsxs)(`form`,{className:`flex gap-2 border-border-soft border-t p-2`,onSubmit:e=>{e.preventDefault();let n=d.trim();n&&(f(``),m.mutate(()=>y.post(`/api/studio/categories/${t.id}/values`,{value:n})))},children:[(0,W.jsx)(E,{value:d,placeholder:l(`know.addValue`),onChange:e=>f(e.target.value),className:`h-9`}),(0,W.jsx)(x,{label:l(`know.addValue`),type:`submit`,children:(0,W.jsx)(p,{className:`size-4`})})]}):null]}),m.error?(0,W.jsx)(`p`,{className:`text-[0.875rem] text-rose`,children:m.error.message}):null]})}function Te(e){return i({queryKey:[`knowledge-value`,e],queryFn:()=>y.get(`/api/studio/values/${e}`),enabled:!!e})}function Ee({value:e,readOnly:t,children:n}){let i=r(),a=s({mutationFn:()=>y.post(`/api/studio/values/${e.id}/summary`),onSuccess:()=>i.invalidateQueries({queryKey:[`knowledge-value`,e.id]})});return(0,W.jsxs)(`div`,{className:`flex flex-col gap-9`,children:[(0,W.jsx)(L,{title:l(`know.summary`),hint:l(`know.summaryHint`),plain:!0,action:t?null:(0,W.jsxs)(A,{variant:`secondary`,size:`sm`,busy:a.isPending,onClick:()=>a.mutate(),children:[e.summary?(0,W.jsx)(f,{className:`size-4`}):null,e.summary?l(`know.summaryAgain`):l(`know.summaryWrite`)]}),children:(0,W.jsxs)(T,{className:`p-4 sm:p-5`,children:[a.isPending?(0,W.jsx)(`div`,{className:`flex h-24 items-center justify-center text-ink-3`,children:(0,W.jsx)(D,{})}):e.summary?(0,W.jsx)(ee,{text:e.summary,className:`text-[0.875rem]`}):(0,W.jsx)(`p`,{className:`text-[0.875rem] text-ink-3`,children:l(`know.summaryEmpty`)}),a.error?(0,W.jsx)(`p`,{className:`mt-3 text-[0.875rem] text-rose`,children:a.error.message}):null]})}),(0,W.jsx)(L,{title:l(`know.toc`),plain:!0,children:n})]})}function De(e){return i({queryKey:[`knowledge`,e],queryFn:()=>y.get(`/api/studio/projects/${e}/knowledge`),enabled:!!e,refetchInterval:e=>e.state.data?.items.some(e=>e.status===`pending`)?2e3:!1})}function Oe(e){return e.kind===`table`?e.format===`faq`?pe:a:e.kind===`file`?d:e.children?le:g}function J({item:e,categories:t,onOpen:n}){let r=Oe(e),i=[ve(t,e.categories),e.children?e.children===1?l(`know.oneSub`):l(`know.sub`,{n:e.children}):``,e.rows===null?``:e.rows===1?l(`know.row`):l(`know.rows`,{n:e.rows}),e.originLabel??``].filter(Boolean).join(` · `);return(0,W.jsxs)(`button`,{type:`button`,onClick:()=>n(e.key),disabled:e.status===`pending`,className:`flex items-start gap-3 rounded-lg px-3 py-2.5 text-left transition hover:bg-accent disabled:pointer-events-none`,children:[(0,W.jsx)(r,{className:`mt-0.5 size-4 shrink-0 text-ink-3`}),(0,W.jsxs)(`span`,{className:`min-w-0 flex-1`,children:[(0,W.jsx)(`span`,{className:`block truncate text-[0.875rem]`,children:e.title}),i?(0,W.jsx)(`span`,{className:`block truncate text-[0.75rem] text-ink-3`,children:i}):null]}),e.status===`pending`?(0,W.jsxs)(`span`,{className:`inline-flex shrink-0 items-center gap-1.5 text-[0.75rem] text-ink-3`,children:[(0,W.jsx)(D,{className:`size-3`}),` `,l(`know.reading`)]}):e.review?(0,W.jsx)(b,{tone:`warn`,title:e.review,children:l(`know.review`)}):null]})}function Y({projectId:e,itemKey:t,has:n,originLabel:r,kept:i,review:a,file:o,readOnly:s,onReviewed:c}){let u=De(e),f=[r?l(i?`know.kept`:`know.from`,{label:r}):``].filter(Boolean);return(0,W.jsxs)(`div`,{className:`flex flex-col gap-2 px-1`,children:[u.data?(0,W.jsx)(xe,{projectId:e,itemKey:t,has:n,categories:u.data.categories,readOnly:s}):null,f.length||o||a?(0,W.jsxs)(`div`,{className:`flex flex-wrap items-center gap-x-3 gap-y-1 text-[0.8125rem] text-ink-3`,children:[f.map(e=>(0,W.jsx)(`span`,{children:e},e)),o?(0,W.jsxs)(`a`,{href:R(e,o.id),target:`_blank`,rel:`noreferrer`,className:`inline-flex items-center gap-1 underline-offset-2 hover:text-ink hover:underline`,children:[(0,W.jsx)(d,{className:`size-3.5`}),` `,l(`know.original`),`: `,o.name]}):null,a?(0,W.jsxs)(`span`,{className:`inline-flex items-center gap-2`,children:[(0,W.jsx)(b,{tone:`warn`,children:l(`know.review`)}),(0,W.jsx)(`span`,{children:a}),s?null:(0,W.jsx)(`button`,{type:`button`,onClick:c,className:`underline hover:text-ink`,children:l(`know.reviewed`)})]}):null]}):null]})}function ke(e){let t=e.filter(Number.isFinite).sort((e,t)=>e-t);if(new Set(t).size<=4)return[];let n=t[0],r=t.at(-1),i=e=>e.slice(0,-1).map((t,n)=>({lo:t,hi:e[n+1]})).filter(e=>t.some(t=>t>=e.lo&&t<e.hi));if(n>0&&r/n>=30){let e=Math.floor(Math.log10(n)),t=Math.floor(Math.log10(r))+1;for(let a of[[1,2,5],[1,3],[1]]){let o=[];for(let n=e;n<=t;n++)for(let e of a)o.push(e*10**n);let s=i(o.filter((e,t)=>e<=n||o[t-1]<=r));if(s.length<=7)return s}}let a=(r-n)/5,o=10**Math.floor(Math.log10(a)),s=([1,2,2.5,5,10].map(e=>e*o).find(e=>e>=a)??a)||1,c=[];for(let e=Math.floor(n/s)*s;e<=r;e+=s)c.push(e);return c.push(c.at(-1)+s),i(c)}function Ae({projectId:e,category:t,categories:n,onOpen:r}){let a=i({queryKey:[`knowledge`,e,`category`,t.id],queryFn:()=>y.get(`/api/studio/categories/${t.id}/items`)});if(!a.data)return a.isLoading?(0,W.jsx)(D,{className:`mx-auto size-4 text-ink-3`}):null;let o=e=>e.categories.find(e=>e.categoryId===t.id)?.values[0],s=[...a.data.items].sort((e,t)=>{let n=o(e),r=o(t);return typeof n==`number`&&typeof r==`number`?n-r:String(r??``).localeCompare(String(n??``),F)}),c=t.type===`number`?ke(s.map(o).filter(e=>typeof e==`number`)):[],u=new Intl.NumberFormat(F,{notation:`compact`,maximumFractionDigits:1}),d=t.unit?` ${t.unit}`:``,f=new Map;for(let e of s){let n=o(e),r=typeof n==`number`?c.find(e=>n>=e.lo&&n<e.hi):void 0,i=n===void 0?``:t.type===`date`?new Date(`${String(n).slice(0,7)}-01T00:00:00`).toLocaleDateString(F,{month:`long`,year:`numeric`}):r?l(`know.range`,{min:`${u.format(r.lo)}${d}`,max:`${u.format(r.hi)}${d}`}):q(t,n);f.set(i,[...f.get(i)??[],e])}return(0,W.jsxs)(`div`,{className:`flex flex-col gap-5`,children:[[...f].map(([e,t])=>(0,W.jsxs)(`div`,{className:`flex flex-col gap-1.5`,children:[e?(0,W.jsx)(`p`,{className:`px-1 font-medium text-[0.6875rem] text-ink-4 uppercase tracking-[0.12em]`,children:e}):null,(0,W.jsx)(T,{className:`flex flex-col p-1.5`,children:t.map(e=>(0,W.jsx)(J,{item:e,categories:n,onOpen:r},e.key))})]},e)),a.data.rows.map(e=>(0,W.jsx)(`button`,{type:`button`,onClick:()=>r(`t:${e.tableId}`),className:`px-1 text-left text-[0.8125rem] text-ink-3 hover:text-ink`,children:l(`know.tocRows`,{n:e.count,table:e.title})},e.tableId))]})}function je(e,t,n){return Array.isArray(n)?t.some(e=>n.map(String).includes(String(e))):typeof n==`object`&&n?t.some(t=>{if(e.type===`number`&&typeof t==`number`)return(n.gte===void 0||t>=n.gte)&&(n.lte===void 0||t<=n.lte);if(e.type===`date`){let e=String(t).slice(0,10);return(!n.after||e>=n.after)&&(!n.before||e<=n.before)}return!n.contains||String(t).toLowerCase().includes(n.contains.toLowerCase())}):t.some(e=>e===n)}function Me(e,t){if(Array.isArray(t))return t.map(String).join(`, `);if(typeof t==`boolean`)return l(t?`know.yes`:`know.no`);if(typeof t==`object`&&t){let n=t.gte??t.after,r=t.lte??t.before;return t.contains?`${l(`know.contains`)} ${t.contains}`:[n===void 0?``:`${l(`know.minimum`)} ${q(e,n)}`,r===void 0?``:`${l(`know.maximum`)} ${q(e,r)}`].filter(Boolean).join(` `)}return String(t)}function Ne({category:e,value:t,onChange:n}){let[r,i]=(0,U.useState)(!1),a=(0,U.useRef)(null);(0,U.useEffect)(()=>{if(!r)return;let e=e=>!a.current?.contains(e.target)&&i(!1);return document.addEventListener(`mousedown`,e),()=>document.removeEventListener(`mousedown`,e)},[r]);let o=G[e.type],s=typeof t==`object`&&t&&!Array.isArray(t)?t:{},c=(t,r)=>{let i={...s,[t]:r===``?void 0:e.type===`number`?Number(r):r},a=Object.fromEntries(Object.entries(i).filter(([,e])=>e!==void 0));n(Object.keys(a).length?a:void 0)};return(0,W.jsxs)(`div`,{ref:a,className:`relative`,children:[(0,W.jsxs)(`button`,{type:`button`,onClick:()=>i(!r),className:I(`inline-flex h-8 items-center gap-1.5 rounded-full px-3 text-[0.8125rem] transition`,t===void 0?`text-ink-2 ring-1 ring-border-soft hover:ring-border`:`bg-ember-tint text-ink ring-1 ring-ember/30`),children:[(0,W.jsx)(o,{className:`size-3.5 text-ink-3`}),e.name,t===void 0?null:(0,W.jsxs)(`span`,{className:`font-medium`,children:[`: `,Me(e,t)]}),(0,W.jsx)(v,{className:`size-3.5 text-ink-3`})]}),r?(0,W.jsxs)(`div`,{className:`absolute top-full left-0 z-30 mt-1.5 w-72 max-w-[calc(100vw-32px)] rounded-xl bg-card p-3 shadow-overlay ring-1 ring-border-soft`,children:[e.type===`choice`?(0,W.jsx)(S,{multi:!0,value:Array.isArray(t)?t.map(String):[],options:e.values.map(e=>e.value),onChange:e=>n(e.length?e:void 0)}):e.type===`boolean`?(0,W.jsx)(S,{value:t===!0?l(`know.yes`):t===!1?l(`know.no`):``,options:[l(`know.yes`),l(`know.no`)],onChange:e=>n(e===l(`know.yes`))}):e.type===`text`?(0,W.jsx)(E,{"data-autofocus":!0,value:s.contains??``,placeholder:l(`know.contains`),onChange:e=>n(e.target.value?{contains:e.target.value}:void 0),className:`h-9`}):(0,W.jsx)(`div`,{className:`grid grid-cols-2 gap-2`,children:(e.type===`number`?[`gte`,`lte`]:[`after`,`before`]).map((t,n)=>(0,W.jsxs)(`div`,{children:[(0,W.jsx)(N,{children:l(n===0?`know.minimum`:`know.maximum`)}),(0,W.jsx)(E,{type:e.type===`number`?`number`:`date`,step:`any`,value:String(s[t]??``),placeholder:e.range?String(n===0?e.range.min:e.range.max):``,onChange:e=>c(t,e.target.value),className:`h-9`})]},t))}),t===void 0?null:(0,W.jsx)(`button`,{type:`button`,onClick:()=>{n(void 0),i(!1)},className:`mt-3 text-[0.8125rem] text-ink-3 underline hover:text-ink`,children:l(`know.clear`)})]}):null]})}function Pe({found:e,onOpen:t}){return e.hits.length?(0,W.jsxs)(`div`,{className:`flex flex-col`,children:[(0,W.jsx)(`p`,{className:`px-3 pt-1 pb-2 text-[0.75rem] text-ink-3`,children:e.checked?l(`know.searchStats`,{candidates:e.candidates,hits:e.hits.length}):l(`know.searchUnchecked`,{hits:e.hits.length})}),e.hits.map(e=>{let n=e.open;return(0,W.jsxs)(`button`,{type:`button`,disabled:!n,onClick:()=>n&&t(n),className:`flex items-start gap-3 rounded-lg px-3 py-2.5 text-left transition hover:bg-accent disabled:pointer-events-none`,children:[(0,W.jsxs)(`span`,{className:`min-w-0 flex-1`,children:[(0,W.jsxs)(`span`,{className:`block truncate text-[0.875rem]`,children:[e.title,e.heading&&e.heading!==e.title?(0,W.jsxs)(`span`,{className:`text-ink-3`,children:[` › `,e.heading]}):null]}),(0,W.jsx)(`span`,{className:`line-clamp-2 text-[0.8125rem] text-ink-3`,children:e.text})]}),e.relevance===null?null:(0,W.jsx)(`span`,{className:`shrink-0 font-medium text-[0.75rem] text-moss tabular-nums`,children:e.relevance.toLocaleString(F,{minimumFractionDigits:2})})]},`${e.key}:${e.heading}`)})]}):(0,W.jsx)(`p`,{className:`px-3 py-4 text-[0.875rem] text-ink-3`,children:l(`know.searchNone`)})}function Fe({kind:e,projectId:t,onClose:n,onMade:i}){let a=r(),[o,c]=(0,U.useState)(``),[u,d]=(0,U.useState)(!1),f=s({mutationFn:()=>y.post(`/api/studio/projects/${t}/${e===`table`?`tables`:`pages`}`,{title:o.trim(),...e===`table`&&u?{format:`faq`}:{}}),onSuccess:async({id:n})=>{await a.invalidateQueries({queryKey:[`knowledge`,t]}),i(`${e===`table`?`t`:`p`}:${n}`),c(``),d(!1)}});return(0,W.jsx)(O,{open:e!==null,onClose:n,title:l(e===`table`?`know.newTable`:`know.newPage`),children:(0,W.jsxs)(`form`,{className:`flex flex-col gap-4`,onSubmit:e=>{e.preventDefault(),o.trim()&&f.mutate()},children:[(0,W.jsxs)(`div`,{children:[(0,W.jsx)(N,{children:l(`data.title`)}),(0,W.jsx)(E,{"data-autofocus":!0,value:o,maxLength:120,onChange:e=>c(e.target.value)})]}),e===`table`?(0,W.jsxs)(`label`,{className:`flex items-center justify-between gap-3 text-[0.875rem]`,children:[l(`know.asFaq`),(0,W.jsx)(C,{checked:u,onChange:d})]}):null,f.error?(0,W.jsx)(`p`,{className:`text-[0.875rem] text-rose`,children:f.error.message}):null,(0,W.jsxs)(`div`,{className:`flex justify-end gap-2`,children:[(0,W.jsx)(A,{variant:`ghost`,onClick:n,children:l(`common.cancel`)}),(0,W.jsx)(A,{type:`submit`,busy:f.isPending,disabled:!o.trim(),children:l(`know.create`)})]})]})})}function Ie({projectId:e,data:t,readOnly:n,onOpen:i}){let a=r(),o=re(e,n),[c,u]=(0,U.useState)({}),[d,f]=(0,U.useState)(``),[m,h]=(0,U.useState)(null),[g,_]=(0,U.useState)(!1),[v,x]=(0,U.useState)(null),S=t.categories.filter(e=>!e.proposed&&e.count>0),C=t.categories.filter(e=>e.proposed),w=t.items.filter(e=>Object.entries(c).every(([n,r])=>{let i=t.categories.find(e=>e.name===n),a=e.categories.find(e=>e.categoryId===i?.id);return i&&a?je(i,a.values,r):!1})),E=async()=>{if(!d.trim()){h(null);return}_(!0);try{h(await y.post(`/api/studio/projects/${e}/search`,{query:d,...Object.keys(c).length?{where:c}:{}}))}catch{h({hits:[],candidates:0,checked:!1,filtered:null})}finally{_(!1)}},O=s({mutationFn:({id:e,keep:t})=>t?y.patch(`/api/studio/categories/${e}`,{proposed:!1}):y.del(`/api/studio/categories/${e}`),onSuccess:()=>a.invalidateQueries({queryKey:[`knowledge`,e]})});return(0,W.jsxs)(L,{title:l(`know.title`),hint:l(`know.hint`),plain:!0,action:n?null:(0,W.jsxs)(`div`,{className:`flex flex-wrap justify-end gap-2`,children:[(0,W.jsxs)(A,{variant:`secondary`,size:`sm`,onClick:()=>x(`page`),children:[(0,W.jsx)(p,{className:`size-4`}),` `,l(`know.page`)]}),(0,W.jsxs)(A,{variant:`secondary`,size:`sm`,onClick:()=>x(`table`),children:[(0,W.jsx)(p,{className:`size-4`}),` `,l(`know.table`)]}),(0,W.jsxs)(A,{variant:`secondary`,size:`sm`,onClick:()=>x(`category`),children:[(0,W.jsx)(p,{className:`size-4`}),` `,l(`know.category`)]})]}),children:[C.length&&!n?(0,W.jsx)(T,{className:`flex flex-col gap-2 p-4`,children:C.map(e=>{let t=G[e.type];return(0,W.jsxs)(`div`,{className:`flex flex-wrap items-center gap-2.5`,children:[(0,W.jsx)(b,{tone:`ember`,children:l(`know.proposed`)}),(0,W.jsx)(t,{className:`size-4 text-ink-3`}),(0,W.jsx)(`span`,{className:`font-medium text-[0.875rem]`,children:e.name}),(0,W.jsx)(`span`,{className:`min-w-0 flex-1 truncate text-[0.8125rem] text-ink-3`,children:[l(`know.type.${e.type}`),e.hint].filter(Boolean).join(` · `)}),(0,W.jsx)(A,{size:`sm`,variant:`ghost`,onClick:()=>O.mutate({id:e.id,keep:!1}),children:l(`know.dismiss`)}),(0,W.jsx)(A,{size:`sm`,onClick:()=>O.mutate({id:e.id,keep:!0}),children:l(`know.accept`)})]},e.id)})}):null,t.items.length?(0,W.jsxs)(`div`,{className:`flex flex-col gap-2`,children:[(0,W.jsx)(ae,{value:d,placeholder:l(`know.search`),busy:g,onEnter:()=>void E(),onChange:e=>{f(e),e.trim()||h(null)}}),S.length?(0,W.jsxs)(`div`,{className:`flex flex-wrap items-center gap-1.5`,children:[S.map(e=>(0,W.jsx)(Ne,{category:e,value:c[e.name],onChange:t=>{h(null),u(n=>{let r={...n};return t===void 0?delete r[e.name]:r[e.name]=t,r})}},e.id)),Object.keys(c).length?(0,W.jsx)(`button`,{type:`button`,onClick:()=>u({}),className:`px-2 text-[0.8125rem] text-ink-3 underline hover:text-ink`,children:l(`know.clear`)}):null]}):null]}):null,(0,W.jsx)(T,{className:`flex flex-col p-1.5`,children:m?(0,W.jsx)(Pe,{found:m,onOpen:i}):w.length?w.map(e=>(0,W.jsx)(J,{item:e,categories:t.categories,onOpen:i},e.key)):(0,W.jsx)(j,{children:l(`know.empty`)})}),n?null:(0,W.jsxs)(oe,{accept:`.pdf,.docx,.doc,.xlsx,.csv,.tsv,.txt,.md,.json,.html,.eml,image/*`,onFiles:async t=>{await o.upload(`document`,t),await a.invalidateQueries({queryKey:[`knowledge`,e]})},className:`h-14 w-full`,children:[o.busy?(0,W.jsx)(D,{className:`size-4`}):(0,W.jsx)(te,{className:`size-4`}),l(`know.drop`),` `,(0,W.jsx)(`span`,{className:`underline`,children:l(`know.pick`)})]}),o.error?(0,W.jsx)(`p`,{className:`text-[0.875rem] text-rose`,children:o.error}):null,t.items.length&&!(t.checked&&t.embeddings)?(0,W.jsx)(`p`,{className:`px-1 text-[0.8125rem] text-ink-3`,children:[t.embeddings?``:l(`know.keywordsOnly`),t.checked?``:l(`know.unchecked`)].filter(Boolean).join(` `)}):null,(0,W.jsx)(Fe,{kind:v===`page`||v===`table`?v:null,projectId:e,onClose:()=>x(null),onMade:e=>{x(null),i(e)}}),(0,W.jsx)(Ce,{projectId:e,open:v===`category`,onClose:()=>x(null),onMade:e=>{x(null),i(`c:${e}`)}})]})}function Le({page:e,onGone:t,onOpen:n}){let i=r(),[a,o]=(0,U.useState)(e.title),[c,d]=(0,U.useState)(e.markdown),[f,h]=(0,U.useState)(e.markdown?`read`:`write`),v=e.knowledge,b=async()=>{await i.invalidateQueries({queryKey:[`space-data`,e.projectId]}),await i.invalidateQueries({queryKey:[`knowledge`,e.projectId]})},S=ne({title:a.trim()||e.title,markdown:c},async t=>{await y.patch(`/api/studio/pages/${e.id}`,t),i.setQueryData([`space-page`,e.id],e=>e&&{...e,...t}),t.title!==e.title&&await b()}),C=s({mutationFn:()=>y.del(`/api/studio/pages/${e.id}`),onSuccess:async()=>{await b(),t()}}),w=s({mutationFn:()=>y.post(`/api/studio/projects/${e.projectId}/pages`,{title:l(`know.addSub`),parentId:e.id}),onSuccess:async({id:e})=>{await b(),n?.(`p:${e}`)}}),E=s({mutationFn:()=>y.patch(`/api/studio/pages/${e.id}`,{review:null}),onSuccess:()=>i.invalidateQueries({queryKey:[`space-page`,e.id]})}),O=async t=>{let r=t.target.closest(`a`)?.getAttribute(`href`);if(!(r?.startsWith(`pages/`)&&n))return;t.preventDefault();let i=await y.get(`/api/studio/projects/${e.projectId}/resolve?path=${encodeURIComponent(r)}`).catch(()=>null);i?.kind===`page`&&n(`p:${i.id}`)},k=e.readOnly,j=v?.file&&(v.file.mime===`application/pdf`||v.file.mime.startsWith(`image/`))?v.file:null,M=(e,t)=>(0,W.jsx)(`button`,{type:`button`,"aria-pressed":f===e,onClick:()=>h(e),className:I(`rounded-full px-3 py-1 text-[0.8125rem] transition`,f===e?`bg-paper-2 font-medium text-ink`:`text-ink-3 hover:text-ink`),children:t});return(0,W.jsxs)(`section`,{className:`flex flex-col gap-3`,children:[v?.parents.length&&n?(0,W.jsx)(`nav`,{className:`-mb-1.5 flex flex-wrap items-center gap-1 px-1 text-[0.8125rem] text-ink-3`,children:v.parents.map(e=>(0,W.jsxs)(`span`,{className:`inline-flex items-center gap-1`,children:[(0,W.jsx)(`button`,{type:`button`,onClick:()=>n(`p:${e.id}`),className:`hover:text-ink`,children:e.title}),(0,W.jsx)(_,{className:`size-3.5`})]},e.id))}):null,(0,W.jsxs)(`div`,{className:`flex items-center gap-2 px-1`,children:[(0,W.jsx)(`input`,{value:a,disabled:k,maxLength:200,onChange:e=>o(e.target.value),"aria-label":l(`data.title`),className:`-ml-1 min-w-0 flex-1 rounded-md bg-transparent px-1 font-display font-semibold text-lg outline-none hover:bg-accent focus:bg-paper focus:ring-1 focus:ring-ring disabled:hover:bg-transparent`}),S.state===`saving`?(0,W.jsx)(D,{className:`size-3.5 text-ink-3`}):S.state===`saved`?(0,W.jsx)(m,{className:`size-4 text-moss`,"aria-label":l(`settings.saved`)}):null,k?null:(0,W.jsx)(x,{label:l(`data.deletePage`),onClick:()=>confirm(l(`data.confirmDelete`,{title:e.title}))&&C.mutate(),className:`hover:text-rose`,children:(0,W.jsx)(u,{className:`size-4`})})]}),v?(0,W.jsx)(Y,{projectId:e.projectId,itemKey:`p:${e.id}`,has:v.categories,originLabel:v.originLabel,kept:v.kept,review:v.review,file:j?null:v.file,readOnly:k,onReviewed:()=>E.mutate()}):null,(0,W.jsxs)(T,{className:`flex flex-col`,children:[k&&!j?null:(0,W.jsxs)(`div`,{className:`flex items-center gap-1 border-border-soft border-b px-2 py-1.5`,children:[k?null:M(`write`,l(`data.write`)),M(`read`,l(`data.preview`)),j?M(`original`,l(`know.original`)):null,(0,W.jsx)(`span`,{className:`ml-auto truncate px-2 text-[0.75rem] text-ink-4 max-sm:hidden`,children:f===`original`&&j?j.name:l(`data.markdownHint`)})]}),f===`original`&&j?j.mime===`application/pdf`?(0,W.jsx)(`iframe`,{src:R(e.projectId,j.id),title:j.name,className:`h-[70dvh] w-full rounded-b-xl bg-paper-2`}):(0,W.jsx)(`img`,{src:R(e.projectId,j.id),alt:``,className:`mx-auto max-h-[70dvh] object-contain p-4`}):f===`write`&&!k?(0,W.jsx)(`textarea`,{value:c,onChange:e=>d(e.target.value),"aria-label":e.title,placeholder:l(`data.pageEmpty`),className:`field-sizing-content min-h-[50vh] w-full resize-none bg-transparent p-4 font-mono text-[0.8125rem] leading-relaxed outline-none placeholder:text-ink-4 sm:p-5`}):(0,W.jsx)(`div`,{className:`min-h-40 p-4 sm:p-5`,onClick:O,children:c.trim()?(0,W.jsx)(ee,{text:c}):(0,W.jsx)(`p`,{className:`text-[0.875rem] text-ink-3`,children:l(`data.pageEmpty`)})})]}),S.state===`error`&&S.error?(0,W.jsx)(`p`,{className:`px-1 text-[0.875rem] text-rose`,children:S.error}):null,v&&n&&(v.children.length||!k)?(0,W.jsxs)(`div`,{className:`mt-3 flex flex-col gap-1.5`,children:[(0,W.jsxs)(`div`,{className:`flex items-center justify-between px-1`,children:[(0,W.jsx)(`p`,{className:`font-medium text-[0.6875rem] text-ink-4 uppercase tracking-[0.12em]`,children:v.children.length?l(`know.subPages`):null}),k?null:(0,W.jsxs)(A,{variant:`ghost`,size:`sm`,busy:w.isPending,onClick:()=>w.mutate(),children:[(0,W.jsx)(p,{className:`size-4`}),` `,l(`know.addSub`)]})]}),v.children.length?(0,W.jsx)(T,{className:`flex flex-col p-1.5`,children:v.children.map(e=>(0,W.jsxs)(`button`,{type:`button`,onClick:()=>n(`p:${e.id}`),className:`flex items-center gap-3 rounded-lg px-3 py-2 text-left transition hover:bg-accent`,children:[(0,W.jsx)(g,{className:`size-4 shrink-0 text-ink-3`}),(0,W.jsx)(`span`,{className:`min-w-0 flex-1 truncate text-[0.875rem]`,children:e.title})]},e.id))}):null]}):null]})}function Re({pageId:e,onGone:t,onOpen:n}){let r=i({queryKey:[`space-page`,e],queryFn:()=>y.get(`/api/studio/pages/${e}`),refetchOnWindowFocus:!1});return r.data?(0,W.jsx)(Le,{page:r.data,onGone:t,onOpen:n},r.data.id):r.isError?(0,W.jsx)(`p`,{className:`text-[0.875rem] text-rose`,children:r.error.message}):null}function ze(e){return i({queryKey:[`space-data`,e],queryFn:()=>y.get(`/api/studio/projects/${e}/data`),enabled:!!e})}function Be(e){let t=t=>[...e.tables.filter(e=>e.wizardId===t).map(e=>({key:`t:${e.id}`,kind:`table`,title:e.title,rows:e.rows})),...e.pages.filter(e=>e.wizardId===t).map(e=>({key:`p:${e.id}`,kind:`page`,title:e.title}))];return[{key:`own`,label:l(`data.own`),items:t(null)},...e.wizards.map(e=>({key:e.id,label:e.title,items:t(e.id)}))].filter(e=>e.items.length)}var Ve={table:a,page:g};function He({kind:e,projectId:t,data:n,onClose:i,onMade:a}){let o=r(),[c,u]=(0,U.useState)(``),[d,f]=(0,U.useState)(``),p=s({mutationFn:()=>y.post(`/api/studio/projects/${t}/${e===`table`?`tables`:`pages`}`,{title:c.trim(),wizardId:d||null}),onSuccess:async({id:n})=>{await o.invalidateQueries({queryKey:[`space-data`,t]}),a(`${e===`table`?`t`:`p`}:${n}`),u(``),f(``)}});return(0,W.jsx)(O,{open:e!==null,onClose:i,title:l(e===`table`?`data.newTable`:`data.newPage`),children:(0,W.jsxs)(`form`,{className:`flex flex-col gap-4`,onSubmit:e=>{e.preventDefault(),c.trim()&&p.mutate()},children:[(0,W.jsxs)(`div`,{children:[(0,W.jsx)(N,{children:l(`data.title`)}),(0,W.jsx)(E,{"data-autofocus":!0,value:c,maxLength:120,onChange:e=>u(e.target.value)})]}),(0,W.jsxs)(`div`,{children:[(0,W.jsx)(N,{children:l(`data.owner`)}),(0,W.jsx)(k,{value:d,onChange:f,options:[{value:``,label:l(`data.own`)},...n.wizards.map(e=>({value:e.id,label:e.title}))]})]}),p.error?(0,W.jsx)(`p`,{className:`text-[0.875rem] text-rose`,children:p.error.message}):null,(0,W.jsxs)(`div`,{className:`flex justify-end gap-2`,children:[(0,W.jsx)(A,{variant:`ghost`,onClick:i,children:l(`common.cancel`)}),(0,W.jsx)(A,{type:`submit`,busy:p.isPending,disabled:!c.trim(),children:l(`data.create`)})]})]})})}function Ue({projectId:e,data:t,readOnly:n,onOpen:r}){let[i,a]=(0,U.useState)(null),o=Be(t),s=new Map([...t.tables.map(e=>[`t:${e.id}`,e.updatedAt]),...t.pages.map(e=>[`p:${e.id}`,e.updatedAt])]),c=new Intl.DateTimeFormat(F,{dateStyle:`medium`});return(0,W.jsxs)(L,{title:l(`space.data`),hint:l(`data.hint`),plain:!0,action:n?null:(0,W.jsxs)(`div`,{className:`flex gap-2`,children:[(0,W.jsxs)(A,{variant:`secondary`,size:`sm`,onClick:()=>a(`table`),children:[(0,W.jsx)(p,{className:`size-4`}),` `,l(`data.table`)]}),(0,W.jsxs)(A,{variant:`secondary`,size:`sm`,onClick:()=>a(`page`),children:[(0,W.jsx)(p,{className:`size-4`}),` `,l(`data.page`)]})]}),children:[o.length?(0,W.jsx)(`div`,{className:`flex flex-col gap-5`,children:o.map(e=>(0,W.jsxs)(`div`,{className:`flex flex-col gap-1.5`,children:[(0,W.jsx)(`p`,{className:`px-1 font-medium text-[0.6875rem] text-ink-4 uppercase tracking-[0.12em]`,children:e.label}),(0,W.jsx)(T,{className:`flex flex-col p-1.5`,children:e.items.map(e=>{let t=Ve[e.kind];return(0,W.jsxs)(`button`,{type:`button`,onClick:()=>r(e.key),className:`flex items-center gap-3 rounded-lg px-3 py-2.5 text-left transition hover:bg-accent`,children:[(0,W.jsx)(t,{className:`size-4 shrink-0 text-ink-3`}),(0,W.jsx)(`span`,{className:`min-w-0 flex-1 truncate text-[0.875rem]`,children:e.title}),(0,W.jsxs)(`span`,{className:`shrink-0 text-[0.75rem] text-ink-3 tabular-nums`,children:[e.kind===`table`?`${l(`data.rows`,{n:e.rows??0})} · `:``,c.format(new Date(s.get(e.key)??Date.now()))]})]},e.key)})})]},e.key))}):(0,W.jsx)(T,{children:(0,W.jsx)(j,{children:l(`data.empty`)})}),(0,W.jsx)(He,{kind:i,projectId:e,data:t,onClose:()=>a(null),onMade:e=>{a(null),r(e)}})]})}function We(e,t){let n=e.normalize(`NFKD`).replace(/[̀-ͯ]/g,``).toLowerCase().replace(/[^a-z0-9]+/g,`_`).replace(/^_+|_+$/g,``).replace(/^[^a-z]+/,``).slice(0,48)||`column`,r=n,i=2;for(;t.includes(r);)r=`${n}_${i++}`;return r}var Ge={milliseconds:1,seconds:1e3,minutes:6e4,hours:36e5,days:864e5},Ke=[`text`,`number`,`date`,`duration`,`select`,`boolean`];function qe(e,t){if(t==null)return``;if(e.type===`duration`&&typeof t==`number`)return String(t/Ge[e.format.inputUnit]);if(e.type===`date`&&e.format.kind===`datetime`&&typeof t==`string`){let e=new Date(t);return new Date(e.getTime()-e.getTimezoneOffset()*6e4).toISOString().slice(0,16)}return String(t)}function Je(e,t){return t.trim()===``?null:e.type===`date`&&e.format.kind===`datetime`?new Date(t).toISOString():t}var X=`w-full min-w-0 rounded-md bg-transparent px-2 py-1.5 text-[0.875rem] outline-none transition placeholder:text-ink-4 hover:bg-accent focus:bg-paper focus:ring-1 focus:ring-ring disabled:hover:bg-transparent`;function Ye({column:e,value:t,readOnly:n,invalid:r,onSave:i}){let a=qe(e,t),[o,s]=(0,U.useState)(a);(0,U.useEffect)(()=>s(a),[a]);let c=(t=o)=>{t!==a&&i(Je(e,t))};if(e.type===`boolean`)return(0,W.jsx)(`div`,{className:`px-2 py-1.5`,children:(0,W.jsx)(`input`,{type:`checkbox`,checked:t===!0,disabled:n,onChange:e=>i(e.target.checked),"aria-label":e.name,className:`size-4 accent-[var(--ember)]`})});if(e.type===`select`&&e.format.multiple){let r=Array.isArray(t)?t:[],a=t=>e.format.options.find(e=>e.id===t)?.label??t;return(0,W.jsxs)(`div`,{className:`flex flex-wrap items-center gap-1 px-2 py-1`,children:[r.map(e=>(0,W.jsxs)(`span`,{className:`inline-flex items-center gap-1 rounded-full bg-paper-2 py-0.5 pr-1 pl-2 text-[0.75rem]`,children:[a(e),n?null:(0,W.jsx)(`button`,{type:`button`,"aria-label":l(`data.removeOption`),onClick:()=>i(r.filter(t=>t!==e)),className:`rounded-full text-ink-3 hover:text-ink`,children:(0,W.jsx)(h,{className:`size-3`})})]},e)),n?null:(0,W.jsxs)(`select`,{value:``,onChange:e=>e.target.value&&i([...r,e.target.value]),"aria-label":e.name,className:`h-7 rounded-md bg-transparent px-1 text-[0.75rem] text-ink-3 outline-none hover:bg-accent`,children:[(0,W.jsx)(`option`,{value:``,children:`+`}),e.format.options.filter(e=>!r.includes(e.id)).map(e=>(0,W.jsx)(`option`,{value:e.id,children:e.label},e.id))]})]})}if(e.type===`select`)return(0,W.jsxs)(`select`,{value:typeof t==`string`?t:``,disabled:n,onChange:e=>i(e.target.value||null),"aria-label":e.name,className:X,children:[(0,W.jsx)(`option`,{value:``}),e.format.options.map(e=>(0,W.jsx)(`option`,{value:e.id,children:e.label},e.id))]});if(e.type===`text`&&e.format?.style&&e.format.style!==`single`)return(0,W.jsx)(`textarea`,{value:o,rows:1,disabled:n,onChange:e=>s(e.target.value),onBlur:()=>c(),"aria-label":e.name,className:I(X,`field-sizing-content max-h-40 resize-none`)});let u=e.type===`date`?{date:`date`,datetime:`datetime-local`,time:`time`}[e.format.kind]:`text`;return(0,W.jsx)(`input`,{type:u,inputMode:e.type===`number`||e.type===`duration`?`decimal`:void 0,value:o,disabled:n,onChange:t=>{s(t.target.value),e.type===`date`&&c(t.target.value)},onBlur:()=>e.type!==`date`&&c(),onKeyDown:e=>{e.key===`Enter`&&e.target.blur(),e.key===`Escape`&&s(a)},"aria-label":e.name,className:I(X,(e.type===`number`||e.type===`duration`)&&`text-right tabular-nums`,r&&`ring-1 ring-rose`)})}function Xe(e){return e.type===`number`&&e.format.style===`currency`?e.format.currency??null:e.type===`number`&&e.format.style===`percent`?`%`:e.type===`duration`?l(`data.unit.${e.format.inputUnit}`):null}function Ze(e){return{name:e?.name??``,type:e?.type??`text`,required:e?.required??!1,textStyle:e?.type===`text`&&(e.format?.style??`single`)!==`single`?`multiline`:`single`,numberStyle:e?.type===`number`?e.format.style:`decimal`,currency:e?.type===`number`?e.format.currency??`EUR`:`EUR`,dateKind:e?.type===`date`?e.format.kind:`date`,unit:e?.type===`duration`&&[`minutes`,`hours`,`days`].includes(e.format.inputUnit)?e.format.inputUnit:`minutes`,options:e?.type===`select`?e.format.options.map(e=>e.label).join(`
3
+ `):``,multiple:e?.type===`select`&&!!e.format.multiple}}function Qe(e,t,n){let r={id:t,name:e.name.trim(),...e.required?{required:!0}:{}};switch(e.type){case`number`:return{...r,type:`number`,format:e.numberStyle===`currency`?{style:`currency`,currency:e.currency.trim().toUpperCase()}:{style:e.numberStyle}};case`date`:return{...r,type:`date`,format:{kind:e.dateKind}};case`duration`:return{...r,type:`duration`,format:{inputUnit:e.unit,display:`hms`}};case`select`:{let t=n?.type===`select`?n.format.options:[],i=[],a=e.options.split(`
4
+ `).map(e=>e.trim()).filter(Boolean).map(e=>{let n=t.find(t=>t.label===e)?.id??We(e,i);return i.push(n),{id:n,label:e}});return{...r,type:`select`,format:{allowCustom:!1,options:a,...e.multiple?{multiple:!0}:{}}}}case`boolean`:return{...r,type:`boolean`};default:return{...r,type:`text`,...e.textStyle===`multiline`?{format:{style:`multiline`}}:{}}}}function $e({open:e,column:t,columns:n,onClose:r,onSave:i}){let[a,o]=(0,U.useState)(()=>Ze(t)),[s,c]=(0,U.useState)(null),[u,d]=(0,U.useState)(!1);(0,U.useEffect)(()=>{e&&(o(Ze(t)),c(null))},[e,t]);let f=e=>o(t=>({...t,...e})),p=async e=>{d(!0),c(null);try{await i(e),r()}catch(e){c(e.message)}finally{d(!1)}},m=()=>{let e=t?.id??We(a.name,n.map(e=>e.id)),r=Qe(a,e,t);return p(t?n.map(e=>e.id===t.id?r:e):[...n,r])};return(0,W.jsx)(O,{open:e,onClose:r,title:t?t.name:l(`data.newColumn`),children:(0,W.jsxs)(`form`,{className:`flex flex-col gap-4`,onSubmit:e=>{e.preventDefault(),a.name.trim()&&m()},children:[(0,W.jsxs)(`div`,{className:`grid gap-3 sm:grid-cols-2`,children:[(0,W.jsxs)(`div`,{children:[(0,W.jsx)(N,{children:l(`data.columnName`)}),(0,W.jsx)(E,{"data-autofocus":!0,value:a.name,maxLength:128,onChange:e=>f({name:e.target.value})})]}),(0,W.jsxs)(`div`,{children:[(0,W.jsx)(N,{children:l(`data.columnType`)}),(0,W.jsx)(k,{value:a.type,onChange:e=>f({type:e}),options:Ke.map(e=>({value:e,label:l(`data.type.${e}`)}))})]})]}),a.type===`text`?(0,W.jsx)(k,{value:a.textStyle,onChange:e=>f({textStyle:e}),options:[{value:`single`,label:l(`data.text.single`)},{value:`multiline`,label:l(`data.text.multiline`)}]}):null,a.type===`number`?(0,W.jsxs)(`div`,{className:`grid gap-3 sm:grid-cols-2`,children:[(0,W.jsx)(k,{value:a.numberStyle,onChange:e=>f({numberStyle:e}),options:[`integer`,`decimal`,`percent`,`currency`].map(e=>({value:e,label:l(`data.number.${e}`)}))}),a.numberStyle===`currency`?(0,W.jsx)(E,{value:a.currency,maxLength:3,"aria-label":l(`data.currency`),placeholder:`EUR`,onChange:e=>f({currency:e.target.value})}):null]}):null,a.type===`date`?(0,W.jsx)(k,{value:a.dateKind,onChange:e=>f({dateKind:e}),options:[`date`,`datetime`,`time`].map(e=>({value:e,label:l(`data.date.${e}`)}))}):null,a.type===`duration`?(0,W.jsxs)(`div`,{children:[(0,W.jsx)(N,{children:l(`data.unit`)}),(0,W.jsx)(k,{value:a.unit,onChange:e=>f({unit:e}),options:[`minutes`,`hours`,`days`].map(e=>({value:e,label:l(`data.unit.${e}`)}))})]}):null,a.type===`select`?(0,W.jsxs)(`div`,{className:`flex flex-col gap-3`,children:[(0,W.jsxs)(`div`,{children:[(0,W.jsx)(N,{children:l(`data.options`)}),(0,W.jsx)(P,{minRows:3,value:a.options,onChange:e=>f({options:e.target.value})})]}),(0,W.jsxs)(`label`,{className:`flex items-center gap-3 text-[0.875rem]`,children:[(0,W.jsx)(C,{checked:a.multiple,onChange:e=>f({multiple:e})}),l(`data.multiple`)]})]}):null,(0,W.jsxs)(`label`,{className:`flex items-center gap-3 text-[0.875rem]`,children:[(0,W.jsx)(C,{checked:a.required,onChange:e=>f({required:e})}),l(`data.required`)]}),s?(0,W.jsx)(`p`,{className:`text-[0.875rem] text-rose`,children:s}):null,(0,W.jsxs)(`div`,{className:`flex items-center gap-2`,children:[t&&n.length>1?(0,W.jsx)(A,{variant:`ghost`,className:`text-rose`,disabled:u,onClick:()=>confirm(l(`data.confirmDelete`,{title:t.name}))&&void p(n.filter(e=>e.id!==t.id)),children:l(`data.deleteColumn`)}):null,(0,W.jsx)(`span`,{className:`flex-1`}),(0,W.jsx)(A,{variant:`ghost`,onClick:r,children:l(`common.cancel`)}),(0,W.jsx)(A,{type:`submit`,busy:u,disabled:!a.name.trim(),children:l(`settings.save`)})]})]})})}function et({tableId:e,onGone:t}){let n=r(),a=[`space-table`,e],o=i({queryKey:a,queryFn:()=>y.get(`/api/studio/tables/${e}`)}),[c,d]=(0,U.useState)(null),[f,m]=(0,U.useState)(null),[h,g]=(0,U.useState)(null),[_,v]=(0,U.useState)(``);(0,U.useEffect)(()=>v(o.data?.title??``),[o.data?.title]);let b=async()=>{await n.invalidateQueries({queryKey:[`space-data`,o.data?.projectId]}),await n.invalidateQueries({queryKey:[`knowledge`,o.data?.projectId]})},S=e=>n.setQueryData(a,t=>t&&{...t,rows:e(t.rows)}),C=e=>{m(e.message),o.refetch()},w=async t=>{await y.patch(`/api/studio/tables/${e}`,t),await o.refetch(),await b()},E=s({mutationFn:({row:t,column:n,value:r})=>y.patch(`/api/studio/tables/${e}/rows/${t}`,{cells:{[n]:r}}),onSuccess:(e,{row:t,column:n})=>{m(null),g(e=>e===`${t}:${n}`?null:e),S(t=>t.map(t=>t.id===e.id?{...t,cells:e.cells}:t))},onError:(e,{row:t,column:n})=>{if(e instanceof M&&e.body?.column===n){let e=o.data?.columns.find(e=>e.id===n)?.name??n;g(`${t}:${n}`),m(l(`data.badCell`,{column:e}));return}C(e)}}),D=s({mutationFn:()=>y.post(`/api/studio/tables/${e}/rows`,{}),onSuccess:async e=>{S(t=>[...t,{...e,updatedAt:new Date().toISOString()}]),await b()},onError:C}),O=s({mutationFn:t=>y.post(`/api/studio/tables/${e}/rows/delete`,{ids:[t]}),onSuccess:async(e,t)=>{S(e=>e.filter(e=>e.id!==t)),await b()},onError:C}),k=s({mutationFn:()=>y.del(`/api/studio/tables/${e}`),onSuccess:async()=>{await b(),t()}});if(!o.data)return o.isError?(0,W.jsx)(`p`,{className:`text-[0.875rem] text-rose`,children:o.error.message}):null;let{columns:j,rows:N,readOnly:P}=o.data,F=!!o.data.list;return(0,W.jsxs)(`section`,{className:`flex flex-col gap-3`,children:[(0,W.jsxs)(`div`,{className:`flex items-center gap-2 px-1`,children:[(0,W.jsx)(`input`,{value:_,disabled:P,maxLength:120,onChange:e=>v(e.target.value),onBlur:()=>_.trim()&&_!==o.data?.title&&void w({title:_}).catch(C),onKeyDown:e=>e.key===`Enter`&&e.target.blur(),"aria-label":l(`data.title`),className:`-ml-1 min-w-0 flex-1 rounded-md bg-transparent px-1 font-display font-semibold text-lg outline-none hover:bg-accent focus:bg-paper focus:ring-1 focus:ring-ring disabled:hover:bg-transparent`}),P?null:(0,W.jsx)(x,{label:l(`data.deleteTable`),onClick:()=>confirm(l(`data.confirmDelete`,{title:o.data.title}))&&k.mutate(),className:`hover:text-rose`,children:(0,W.jsx)(u,{className:`size-4`})})]}),F?(0,W.jsx)(`p`,{className:`-mt-1.5 px-1 text-[0.8125rem] text-ink-3`,children:l(`data.fromList`)}):null,o.data.knowledge?(0,W.jsx)(Y,{projectId:o.data.projectId,itemKey:`t:${o.data.id}`,has:o.data.knowledge.categories,originLabel:o.data.knowledge.originLabel,kept:o.data.knowledge.kept,review:o.data.knowledge.review,file:o.data.knowledge.file,readOnly:P,onReviewed:()=>void y.patch(`/api/studio/tables/${e}`,{review:null}).then(()=>o.refetch()).catch(C)}):null,(0,W.jsxs)(T,{className:`overflow-hidden`,children:[(0,W.jsx)(`div`,{className:`overflow-x-auto`,children:(0,W.jsxs)(`table`,{className:`w-full border-collapse text-left`,children:[(0,W.jsx)(`thead`,{children:(0,W.jsxs)(`tr`,{className:`border-border-soft border-b`,children:[j.map(e=>(0,W.jsx)(`th`,{className:`min-w-36 border-border-soft border-l p-1 font-medium first:border-l-0`,children:(0,W.jsxs)(`button`,{type:`button`,disabled:P||F,onClick:()=>d(e),className:`flex w-full items-center gap-1 rounded-md px-2 py-1.5 text-left text-[0.8125rem] text-ink-2 transition hover:bg-accent hover:text-ink disabled:hover:bg-transparent`,children:[(0,W.jsx)(`span`,{className:`truncate`,children:e.name}),e.required?(0,W.jsx)(`span`,{className:`text-ember`,children:`*`}):null,Xe(e)?(0,W.jsx)(`span`,{className:`font-normal text-ink-4`,children:Xe(e)}):null]})},e.id)),(0,W.jsx)(`th`,{className:`w-10 p-1`,children:P||F?null:(0,W.jsx)(x,{label:l(`data.newColumn`),onClick:()=>d(`new`),className:`size-8`,children:(0,W.jsx)(p,{className:`size-4`})})})]})}),(0,W.jsx)(`tbody`,{children:N.map(e=>(0,W.jsxs)(`tr`,{className:`group border-border-soft border-b last:border-b-0`,children:[j.map(t=>(0,W.jsx)(`td`,{className:`border-border-soft border-l p-1 align-top first:border-l-0`,children:(0,W.jsx)(Ye,{column:t,value:e.cells[t.id],readOnly:P,invalid:h===`${e.id}:${t.id}`,onSave:n=>E.mutate({row:e.id,column:t.id,value:n})})},t.id)),(0,W.jsx)(`td`,{className:`w-10 p-1 align-top`,children:P?null:(0,W.jsx)(x,{label:l(`data.deleteRow`),onClick:()=>O.mutate(e.id),className:`size-8 opacity-0 hover:text-rose focus:opacity-100 group-hover:opacity-100 coarse:opacity-100`,children:(0,W.jsx)(u,{className:`size-3.5`})})})]},e.id))})]})}),N.length?null:(0,W.jsx)(`p`,{className:`px-4 py-6 text-center text-[0.875rem] text-ink-3`,children:l(`data.noRows`)}),P?null:(0,W.jsx)(`div`,{className:`border-border-soft border-t p-1.5`,children:(0,W.jsxs)(A,{variant:`ghost`,size:`sm`,busy:D.isPending,onClick:()=>D.mutate(),children:[(0,W.jsx)(p,{className:`size-4`}),` `,l(`data.addRow`)]})})]}),f?(0,W.jsx)(`p`,{className:`px-1 text-[0.875rem] text-rose`,children:f}):null,(0,W.jsx)($e,{open:c!==null,column:c===`new`?null:c,columns:j,onClose:()=>d(null),onSave:e=>w({columns:e})})]})}var tt=`wizards.runDrawer.width`,nt=`wizards.runDrawer.wide`,rt=`wizards.runDrawer.look`,it=680,Z=400,at=()=>Math.max(Z,window.innerWidth-120);function Q(e){try{return localStorage.getItem(e)}catch{return null}}function $(e,t){try{localStorage.setItem(e,t)}catch{}}function ot(){let[e,t]=(0,U.useState)(()=>{let e=Number(Q(tt));return e?Math.min(Math.max(e,Z),at()):it}),[n,r]=(0,U.useState)(()=>Q(nt)===`1`),i=(0,U.useCallback)(e=>{let n=Math.round(Math.min(Math.max(e,Z),at()));t(n),$(tt,String(n))},[]);return{width:e,wide:n,toggleWide:()=>{r(!n),$(nt,n?`0`:`1`)},onPointerDown:t=>{t.preventDefault();let n=t.clientX,r=e,a=e=>i(r+n-e.clientX),o=()=>{window.removeEventListener(`pointermove`,a),window.removeEventListener(`pointerup`,o),document.body.style.removeProperty(`cursor`),document.body.style.removeProperty(`user-select`)};document.body.style.cursor=`col-resize`,document.body.style.userSelect=`none`,window.addEventListener(`pointermove`,a),window.addEventListener(`pointerup`,o)},onKeyDown:t=>{let n=t.shiftKey?64:16;t.key===`ArrowLeft`?(t.preventDefault(),i(e+n)):t.key===`ArrowRight`&&(t.preventDefault(),i(e-n))},reset:()=>i(it)}}function st(){let[e,t]=(0,U.useState)(()=>Q(rt)===`chat`?`chat`:`steps`);return[e,e=>{t(e),$(rt,e)}]}function ct({look:e,onChange:t}){let n=[{id:`steps`,label:l(`chat.steps`),Icon:fe},{id:`chat`,label:l(`chat.chat`),Icon:pe}];return(0,W.jsx)(`fieldset`,{"aria-label":l(`chat.view`),className:`m-0 flex min-w-0 rounded-full border-0 bg-paper-2 p-0.5`,children:n.map(({id:n,label:r,Icon:i})=>(0,W.jsxs)(`button`,{type:`button`,"aria-pressed":e===n,title:r,onClick:()=>t(n),className:I(`inline-flex h-7 items-center gap-1.5 rounded-full px-2.5 font-medium text-[0.75rem] transition coarse:h-9`,e===n?`bg-card text-ink shadow-soft`:`text-ink-3 hover:text-ink`),children:[(0,W.jsx)(i,{className:`size-3.5`}),(0,W.jsx)(`span`,{className:`max-sm:hidden`,children:r})]},n))})}function lt({header:e,actions:t,onClose:n,children:r}){let i=ot();return(0,W.jsx)(`div`,{className:`fixed inset-0 z-50 flex justify-end bg-[oklch(20%_0.01_60/0.22)] backdrop-blur-[1px]`,onClick:n,children:(0,W.jsxs)(`div`,{className:I(`relative flex h-full w-full animate-rise flex-col bg-background shadow-overlay`,!i.wide&&`sm:w-[var(--drawer)]`),style:{"--drawer":`${i.width}px`},onClick:e=>e.stopPropagation(),children:[i.wide?null:(0,W.jsx)(`div`,{role:`separator`,"aria-orientation":`vertical`,"aria-label":l(`editor.resize`),"aria-valuenow":i.width,tabIndex:0,title:l(`editor.resize`),onPointerDown:i.onPointerDown,onKeyDown:i.onKeyDown,onDoubleClick:i.reset,className:`group -left-2.5 absolute inset-y-0 z-10 hidden w-5 cursor-col-resize outline-none sm:block`,children:(0,W.jsx)(`span`,{className:`-translate-y-1/2 absolute top-1/2 left-[7px] h-12 w-1.5 rounded-full bg-ink-4/40 transition group-hover:bg-ember/70 group-focus-visible:bg-ember group-active:h-16 group-active:bg-ember`})}),(0,W.jsxs)(`div`,{className:`flex h-14 shrink-0 items-center gap-3 px-4`,children:[(0,W.jsx)(`div`,{className:`flex min-w-0 flex-1 items-center gap-3`,children:e}),(0,W.jsxs)(`div`,{className:`flex items-center gap-1`,children:[t,(0,W.jsx)(x,{label:l(i.wide?`runDrawer.shrink`:`runDrawer.expand`),onClick:i.toggleWide,className:`max-sm:hidden`,children:i.wide?(0,W.jsx)(ie,{className:`size-4`}):(0,W.jsx)(c,{className:`size-4`})}),(0,W.jsx)(x,{label:l(`editor.close`),onClick:n,children:(0,W.jsx)(h,{className:`size-5`})})]})]}),(0,W.jsx)(`div`,{className:`min-h-0 flex-1 overflow-y-auto`,children:r})]})})}export{Ee as _,Ve as a,de as b,ze as c,J as d,Y as f,we as g,G as h,et as i,Re as l,De as m,lt as n,Ue as o,Ie as p,st as r,Be as s,ct as t,Ae as u,Te as v,z as x,ge as y};