wizards 0.2.53 → 0.2.54

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 (25) hide show
  1. package/apps/runtime/dist/docs/dev/wizard-format.md +6 -6
  2. package/apps/web/dist/assets/{AboutDialog-CaAciOW6.js → AboutDialog-BXpMzzUl.js} +1 -1
  3. package/apps/web/dist/assets/{ChangelogDialog-BeNIsyGf.js → ChangelogDialog-Da3M36M6.js} +1 -1
  4. package/apps/web/dist/assets/{ChatView-NPPYrX5F.js → ChatView-BGpIFoML.js} +1 -1
  5. package/apps/web/dist/assets/{EditorPage-gom6fxxk.js → EditorPage-DH6SrKPQ.js} +1 -1
  6. package/apps/web/dist/assets/{FlowPreview-1ODg6IWK.js → FlowPreview-Cy_oSpCG.js} +1 -1
  7. package/apps/web/dist/assets/{Harness-DE0zoJi-.js → Harness-0TcBTo1Z.js} +1 -1
  8. package/apps/web/dist/assets/{Marketplace-rpno9mXk.js → Marketplace-D1iet5FD.js} +2 -2
  9. package/apps/web/dist/assets/{NewWizardPage-QFqRz6OF.js → NewWizardPage-CsuU51QL.js} +1 -1
  10. package/apps/web/dist/assets/{ProjectPage-BejGQ5vn.js → ProjectPage-DCPKr4sC.js} +1 -1
  11. package/apps/web/dist/assets/{PublicRunner-hpHMdW5M.js → PublicRunner-B6Er82D3.js} +1 -1
  12. package/apps/web/dist/assets/{RunDrawer-D27FWKCN.js → RunDrawer-BbyQVQLN.js} +1 -1
  13. package/apps/web/dist/assets/{RunnerView-DjxjM6nc.js → RunnerView-DdEKXIDX.js} +1 -1
  14. package/apps/web/dist/assets/{SettingsPage-r1nsUZRD.js → SettingsPage-D6KuKcBL.js} +1 -1
  15. package/apps/web/dist/assets/{SetupPage-Bpqm8rxq.js → SetupPage-DuD0AD0f.js} +1 -1
  16. package/apps/web/dist/assets/{SharePage-V9yD_XkR.js → SharePage-Bxnu_cet.js} +1 -1
  17. package/apps/web/dist/assets/changelog-Cu_CVR3H.js +1 -0
  18. package/apps/web/dist/assets/{esm-BCmUki0A.js → esm-D2JnXDyS.js} +1 -1
  19. package/apps/web/dist/assets/{index-BQkUg721.js → index-Cl4LqF22.js} +4 -4
  20. package/apps/web/dist/assets/{settings-menu-DCDIXUaT.js → settings-menu-BT8cRZym.js} +1 -1
  21. package/apps/web/dist/index.html +2 -2
  22. package/node_modules/@engenty-wizards/shared/dist/wizard-package.d.ts +5 -3
  23. package/node_modules/@engenty-wizards/shared/dist/wizard-package.js +6 -4
  24. package/package.json +1 -1
  25. package/apps/web/dist/assets/changelog-C8t2fP5p.js +0 -1
@@ -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-mkL5nF_f.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-BCmUki0A.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-mkL5nF_f.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-D2JnXDyS.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-mkL5nF_f.js";import{V as f}from"./index-BQkUg721.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-mkL5nF_f.js";import{V as f}from"./index-Cl4LqF22.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-1ODg6IWK.js","assets/rolldown-runtime-hePW80VL.js","assets/jsx-runtime-BNakU3Ej.js","assets/ui-mkL5nF_f.js","assets/preload-helper-CNEI7N0N.js","assets/esm-BCmUki0A.js","assets/index-BQkUg721.js","assets/logo-C4V2_3Ar.js","assets/engenty-eXZ-EAwd.js","assets/useMutation-DKyQXgyj.js","assets/brand-CwLcF9JR.js","assets/volume-2-C3GeMqc-.js","assets/session-BuVghS-e.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-mkL5nF_f.js";import{l as k,r as ie}from"./brand-CwLcF9JR.js";import{t as ae}from"./volume-2-C3GeMqc-.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-1ODg6IWK.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-Cy_oSpCG.js","assets/rolldown-runtime-hePW80VL.js","assets/jsx-runtime-BNakU3Ej.js","assets/ui-mkL5nF_f.js","assets/preload-helper-CNEI7N0N.js","assets/esm-D2JnXDyS.js","assets/index-Cl4LqF22.js","assets/logo-C4V2_3Ar.js","assets/engenty-eXZ-EAwd.js","assets/useMutation-DKyQXgyj.js","assets/brand-CwLcF9JR.js","assets/volume-2-C3GeMqc-.js","assets/session-BuVghS-e.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-mkL5nF_f.js";import{l as k,r as ie}from"./brand-CwLcF9JR.js";import{t as ae}from"./volume-2-C3GeMqc-.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-Cy_oSpCG.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-rpno9mXk.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-mkL5nF_f.js";import{r as _}from"./brand-CwLcF9JR.js";import{t as v}from"./upload-BfrqabpO.js";import{d as y,s as b}from"./session-BuVghS-e.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-D1iet5FD.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-mkL5nF_f.js";import{r as _}from"./brand-CwLcF9JR.js";import{t as v}from"./upload-BfrqabpO.js";import{d as y,s as b}from"./session-BuVghS-e.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,2 +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-rpno9mXk.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 se,pn as ce,pt as k,rt as A,st as le,ut as j,vt as M,xt as N,y as P,yt as F}from"./ui-mkL5nF_f.js";import{_ as ue,a as de,b as I,c as fe,d as pe,f as L,g as me,h as he,i as ge,l as _e,m as ve,n as R,o as ye,p as be,s as xe,u as Se,v as Ce,x as z,y as B}from"./RunDrawer-D27FWKCN.js";import{r as V,t as H}from"./RunnerView-DjxjM6nc.js";import{n as we,r as U,t as W}from"./ReadOnly-DiOfNtVr.js";import{t as G}from"./upload-BfrqabpO.js";import{c as K,l as Te,s as Ee}from"./session-BuVghS-e.js";import{A as q,F as J,I as De,L as Oe,M as ke,N as Y,P as Ae,R as je,U as Me,_ as Ne,ct as Pe,d as Fe,f as Ie,g as Le,j as Re,k as X,l as ze,p as Be,s as Ve,st as He,u as Ue,y as We,z as Ge}from"./index-BQkUg721.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-DCDIXUaT.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=J(e,t.id);return t.mime.startsWith(`image/`)?(0,$.jsx)(`img`,{src:r,alt:``,loading:`lazy`,className:F(`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)(q,{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=Oe(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),Ae(e.size)].filter(Boolean).join(` · `);function ft({projectId:e,file:t,actions:n,onClose:r}){let i=J(e,t.id);return(0,$.jsxs)(se,{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=Oe(e,n),[i,a]=je(`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)(Re,{layout:i,onToggle:a,children:(0,$.jsx)(ke,{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)(q,{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)(G,{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,Ae(e.size)].filter(Boolean).join(` · `),vt=2e5;function yt({projectId:e,fileId:t,readOnly:n,onGone:i}){let a=r(),o=Ge(e),s=ve(e),c=Oe(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=J(e,l.id),y=(e,t)=>(0,$.jsx)(`button`,{type:`button`,"aria-pressed":h===e,onClick:()=>m(e),className:F(`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)(L,{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)(P,{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(`
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-D1iet5FD.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 se,pn as ce,pt as k,rt as A,st as le,ut as j,vt as M,xt as N,y as P,yt as F}from"./ui-mkL5nF_f.js";import{_ as ue,a as de,b as I,c as fe,d as pe,f as L,g as me,h as he,i as ge,l as _e,m as ve,n as R,o as ye,p as be,s as xe,u as Se,v as Ce,x as z,y as B}from"./RunDrawer-BbyQVQLN.js";import{r as V,t as H}from"./RunnerView-DdEKXIDX.js";import{n as we,r as U,t as W}from"./ReadOnly-DiOfNtVr.js";import{t as G}from"./upload-BfrqabpO.js";import{c as K,l as Te,s as Ee}from"./session-BuVghS-e.js";import{A as q,F as J,I as De,L as Oe,M as ke,N as Y,P as Ae,R as je,U as Me,_ as Ne,ct as Pe,d as Fe,f as Ie,g as Le,j as Re,k as X,l as ze,p as Be,s as Ve,st as He,u as Ue,y as We,z as Ge}from"./index-Cl4LqF22.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-BT8cRZym.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=J(e,t.id);return t.mime.startsWith(`image/`)?(0,$.jsx)(`img`,{src:r,alt:``,loading:`lazy`,className:F(`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)(q,{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=Oe(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),Ae(e.size)].filter(Boolean).join(` · `);function ft({projectId:e,file:t,actions:n,onClose:r}){let i=J(e,t.id);return(0,$.jsxs)(se,{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=Oe(e,n),[i,a]=je(`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)(Re,{layout:i,onToggle:a,children:(0,$.jsx)(ke,{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)(q,{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)(G,{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,Ae(e.size)].filter(Boolean).join(` · `),vt=2e5;function yt({projectId:e,fileId:t,readOnly:n,onGone:i}){let a=r(),o=Ge(e),s=ve(e),c=Oe(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=J(e,l.id),y=(e,t)=>(0,$.jsx)(`button`,{type:`button`,"aria-pressed":h===e,onClick:()=>m(e),className:F(`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)(L,{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)(P,{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
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)(se,{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)(j,{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)(j,{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)(A,{variant:`ghost`,onClick:t,children:f(`common.cancel`)}),(0,$.jsx)(A,{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=De(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)(A,{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:U,number:I,date:z,url:ee,email:He,phone:V,boolean:B};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:F(`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:F(`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:F(`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:F(`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=De(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)(A,{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)(M,{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)(A,{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:N===`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`}),` `,N===`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=De({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)(j,{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)(j,{children:f(`project.about`)}),(0,$.jsx)(M,{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=Ge(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=Te(),p=K(),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)(W,{children:we(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)(A,{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)(k,{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)(k,{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(N,{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)(le,{children:n.q.trim()||n.mode||n.days?f(`space.resultsNone`):f(`space.resultsEmpty`)})})]}),i?(0,$.jsx)(R,{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)(H,{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)(se,{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)(A,{variant:`ghost`,onClick:()=>r(!1),children:f(`common.cancel`)}),(0,$.jsx)(A,{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)(We,{}),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}=ce(),[t,n]=oe(),r=ne(),i=te(),{hash:a}=i,{project:o,loading:c}=Ee(),l=Te(),u=ze(),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=Be().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):[],se=qt([...D,...y===`results`?O:[]].flatMap(e=>e.sections.map(e=>e.id))),k=y===`results`&&S&&S!==`all`?S:null,[A,j]=(0,Q.useState)(Vt),M=Ht(y===`results`?o?.id:void 0,k,A),N=M.data?.wizards.find(e=>e.id===k)?.title,P=y===`data`&&S&&S!==`all`||y===`knowledge`&&S&&/^[ptfcvs]:/.test(S)?S:null,I=P?.startsWith(`s:`)?u.spaceSections.find(e=>e.id===P.slice(2)):void 0,L=y===`knowledge`&&P&&/^[ptf]:/.test(P)?P:null,R=fe(y===`data`?o?.id:void 0),z=ve(y===`knowledge`?o?.id:void 0),B=Ce(P?.startsWith(`v:`)?P.slice(2):``),V=z.data?.categories.find(e=>e.id===(P?.startsWith(`c:`)?P.slice(2):B.data?.category.id)),H=y===`knowledge`?I?I.label():P?.startsWith(`v:`)?B.data&&`${B.data.category.name}: ${B.data.value}`:P?.startsWith(`c:`)?V?.name:z.data?.items.find(e=>e.key===P)?.title:R.data?xe(R.data).flatMap(e=>e.items).find(e=>e.key===P)?.title:void 0;Ne([{label:f(`nav.project`),to:`/space`},...x?[{label:x.label,to:`/space/${x.id}`}]:[],...x&&(h??N??H)?[{label:h??N??H}]:[]]);let we={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`)}]}:{},...P&&H?{open:{kind:we[P[0]]??`item`,id:P.slice(2),label:H}}:k&&N?{open:{kind:`wizard`,id:k,label:N}}:{}});let U=y===`results`||y===`data`||P?a.slice(1):S||a.slice(1),W=(0,Q.useRef)(``);if((0,Q.useEffect)(()=>{let e=`${y}#${U}`;U&&W.current!==e&&document.getElementById(U)&&(W.current=e,requestAnimationFrame(()=>Jt(U,!1)))},[y,U,o?.id,u.spaceSections]),!y){let t=a.slice(1),n=t?Ue(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 G=e=>{if(d){r({search:`?show=${e}`});return}W.current=`${y}#${e}`,Jt(e,!0),r({search:``,hash:e},{replace:!0})},K=e=>d?n({show:e}):n(e===`all`?{}:{show:e},{replace:!0}),q=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)(Ve,{of:e,children:(0,$.jsx)(e.component,{})})})},e.serial)),J=d?void 0:se;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:F(`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:F(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:F(`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&&!k,onPick:()=>K(`all`)}),M.data?.wizards.filter(e=>e.results||e.id===k).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===k,onPick:()=>K(e.id)},e.id))]}),(0,$.jsx)(Yt,{groups:O,current:J,onPick:G})]}):y===`data`?(0,$.jsxs)(Qe,{children:[(0,$.jsx)(`ul`,{className:`flex flex-col gap-0.5`,children:(0,$.jsx)(Z,{icon:Pe,label:f(`data.all`),selected:!d&&!P,onPick:()=>K(`all`)})}),R.data?xe(R.data).map(e=>(0,$.jsx)(Je,{label:e.label,children:e.items.map(e=>(0,$.jsx)(Z,{icon:de[e.kind],label:e.title,selected:!d&&e.key===P,onPick:()=>K(e.key)},e.key))},e.key)):null,(0,$.jsx)(Yt,{groups:O,current:J,onPick:G})]}):y===`knowledge`?(0,$.jsxs)(Qe,{children:[(0,$.jsx)(`ul`,{className:`flex flex-col gap-0.5`,children:(0,$.jsx)(Z,{icon:Pe,label:f(`know.all`),selected:!(d||P),onPick:()=>K(`all`)})}),z.data?.categories.length?(0,$.jsx)(Je,{label:f(`know.categories`),children:z.data.categories.map(e=>(0,$.jsx)(Z,{icon:he[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&&(P===`c:${e.id}`||B.data?.category.id===e.id),onPick:()=>K(`c:${e.id}`)},e.id))}):null,(0,$.jsx)(Yt,{groups:O,current:d?void 0:I?.id,onPick:e=>K(`s:${e}`)})]}):(0,$.jsx)(Qe,{children:(0,$.jsx)(Yt,{groups:D,current:J,onPick:G})}),o&&(y===`info`||y===`knowledge`)?(0,$.jsxs)(Bt,{project:o,group:y,children:[y===`knowledge`?L?L.startsWith(`p:`)?(0,$.jsx)(_e,{pageId:L.slice(2),onGone:()=>K(`all`),onOpen:K},L):L.startsWith(`t:`)?(0,$.jsx)(ge,{tableId:L.slice(2),onGone:()=>K(`all`)},L):(0,$.jsx)(yt,{projectId:o.id,fileId:L.slice(2),readOnly:o.readOnly,onGone:()=>K(`all`)},L):z.data?I?(0,$.jsx)(Y,{title:I.label(),hint:I.hint?.(),plain:!0,children:(0,$.jsx)(Ve,{of:I,children:(0,$.jsx)(I.component,{})})},P):P?.startsWith(`c:`)?V?(0,$.jsxs)(`div`,{className:`flex flex-col gap-5`,children:[(0,$.jsx)(me,{projectId:o.id,category:V,readOnly:o.readOnly,onOpen:K,onGone:()=>K(`all`)}),V.type===`choice`?null:(0,$.jsx)(Se,{projectId:o.id,category:V,categories:z.data.categories,onOpen:K})]},P):null:P?.startsWith(`v:`)?B.data?(0,$.jsx)(ue,{value:B.data,readOnly:o.readOnly,children:(0,$.jsxs)(`div`,{className:`flex flex-col gap-2`,children:[B.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:B.data.items.map(e=>(0,$.jsx)(pe,{item:e,categories:z.data.categories.filter(e=>e.id!==B.data?.category.id),onOpen:K},e.key))}):null,B.data.rows.map(e=>(0,$.jsx)(`button`,{type:`button`,onClick:()=>K(`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))]})},P):null:(0,$.jsx)(X,{id:`documents`,children:(0,$.jsx)(be,{projectId:o.id,data:z.data,readOnly:o.readOnly,onOpen:K})}):null:null,y===`info`?q(O):null]},o.id):null,o&&y===`data`?(0,$.jsx)(`div`,{className:`flex flex-col gap-9 pb-20`,children:P?.startsWith(`t:`)?(0,$.jsx)(ge,{tableId:P.slice(2),onGone:()=>K(`all`)},P):P?.startsWith(`p:`)?(0,$.jsx)(_e,{pageId:P.slice(2),onGone:()=>K(`all`)},P):(0,$.jsxs)($.Fragment,{children:[R.data?(0,$.jsx)(ye,{projectId:o.id,data:R.data,readOnly:o.readOnly,onOpen:K}):null,q(O)]})}):null,o&&y===`results`?(0,$.jsxs)(`div`,{className:`flex flex-col gap-9 pb-20`,children:[M.data?(0,$.jsx)(Wt,{data:M.data,wizardId:k,filter:A,onFilter:j}):null,M.isError?(0,$.jsx)(`p`,{className:`text-[0.875rem] text-rose`,children:M.error.message}):null,q(O)]}):null,o||c?null:(0,$.jsx)(le,{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-mkL5nF_f.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-NPPYrX5F.js";import{c as E,i as D,r as O,t as k}from"./brand-CwLcF9JR.js";import{t as A}from"./RunnerView-DjxjM6nc.js";import{a as j,n as M,o as N}from"./index-BQkUg721.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-mkL5nF_f.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-BGpIFoML.js";import{c as E,i as D,r as O,t as k}from"./brand-CwLcF9JR.js";import{t as A}from"./RunnerView-DdEKXIDX.js";import{a as j,n as M,o as N}from"./index-Cl4LqF22.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};