wizards 0.2.10 → 0.2.11
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/apps/web/dist/assets/{Account-6cwwWOU3.js → Account-BJPPu___.js} +1 -1
- package/apps/web/dist/assets/{ChangelogDialog-DewAXwoQ.js → ChangelogDialog-D5Jc3poI.js} +1 -1
- package/apps/web/dist/assets/{ChatPanel-CCNgem_v.js → ChatPanel-n7GEZxTX.js} +1 -1
- package/apps/web/dist/assets/{EditorPage-DqVuS-JG.js → EditorPage-teTTDbnX.js} +1 -1
- package/apps/web/dist/assets/{FlowPreview-BAVCgsXg.js → FlowPreview-4cRsWwO8.js} +1 -1
- package/apps/web/dist/assets/{Harness-BZCoZ4Z1.js → Harness-OlRaoHGd.js} +1 -1
- package/apps/web/dist/assets/{HomePage-BsuuOXbB.js → HomePage-BGQMVqEr.js} +1 -1
- package/apps/web/dist/assets/{ImportWizard-BG28_HzC.js → ImportWizard-BGs5dv94.js} +1 -1
- package/apps/web/dist/assets/{LocalRuntime-DyJJVozN.js → LocalRuntime-WHeeZvB4.js} +1 -1
- package/apps/web/dist/assets/{NewWizardPage-8B-d3T4k.js → NewWizardPage-h3dWMUgw.js} +2 -2
- package/apps/web/dist/assets/{ProjectPage-CkO8ndix.js → ProjectPage-Cfnwi-pK.js} +1 -1
- package/apps/web/dist/assets/{PublicRunner-DF960weZ.js → PublicRunner-Oa4uTkvr.js} +1 -1
- package/apps/web/dist/assets/{RunnerView-Z3VVOwVR.js → RunnerView-njFeqF1A.js} +1 -1
- package/apps/web/dist/assets/{SettingsPage-BOYAZS08.js → SettingsPage-D4xJ8tEu.js} +1 -1
- package/apps/web/dist/assets/{SetupPage-Cl4Yc7A2.js → SetupPage-DUyvWSdi.js} +1 -1
- package/apps/web/dist/assets/{SharePage-BFRWRmOF.js → SharePage-Bikt8bn4.js} +1 -1
- package/apps/web/dist/assets/changelog-CT8yK95a.js +1 -0
- package/apps/web/dist/assets/{esm-CLbOcpCO.js → esm-CyCiCaFy.js} +1 -1
- package/apps/web/dist/assets/{index-Bl5vhqT3.js → index-Z0fbfnW7.js} +2 -2
- package/apps/web/dist/assets/{meta-DxGh33r8.js → meta-DsCJykuf.js} +1 -1
- package/apps/web/dist/assets/{outputs-BDP8UsZT.js → outputs-Ba-Tblsj.js} +1 -1
- package/apps/web/dist/index.html +1 -1
- package/package.json +1 -1
- package/apps/web/dist/assets/changelog-DhleQ4p1.js +0 -1
|
@@ -1 +1 @@
|
|
|
1
|
-
import{a as e,n as t,t as n}from"./jsx-runtime-D3jfb0Ew.js";import{h as r}from"./ui-gGAdXx-P.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-
|
|
1
|
+
import{a as e,n as t,t as n}from"./jsx-runtime-D3jfb0Ew.js";import{h as r}from"./ui-gGAdXx-P.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-CyCiCaFy.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-[13px] 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-[11px] 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{a as e,n as t,t as n}from"./jsx-runtime-D3jfb0Ew.js";import{c as r,n as i,nt as a}from"./api-u3nydnnp.js";import{t as o}from"./check-CUpby_J9.js";import{t as s}from"./refresh-cw-Cmk7VCe0.js";import{h as c,t as l,y as u}from"./ui-gGAdXx-P.js";import{I as d}from"./index-Bl5vhqT3.js";import{n as f}from"./LocalRuntime-DyJJVozN.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{a as e,n as t,t as n}from"./jsx-runtime-D3jfb0Ew.js";import{c as r,n as i,nt as a}from"./api-u3nydnnp.js";import{t as o}from"./check-CUpby_J9.js";import{t as s}from"./refresh-cw-Cmk7VCe0.js";import{h as c,t as l,y as u}from"./ui-gGAdXx-P.js";import{I as d}from"./index-Z0fbfnW7.js";import{n as f}from"./LocalRuntime-WHeeZvB4.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 +1 @@
|
|
|
1
|
-
import{a as e,i as t,n,t as r}from"./jsx-runtime-D3jfb0Ew.js";import{O as i,d as a,j as o,n as s,nt as c,w as l}from"./api-u3nydnnp.js";import{t as u}from"./createLucideIcon-q3MZMmnf.js";import{t as d}from"./check-CUpby_J9.js";import{n as f,t as p}from"./plus-Du-Jx8aI.js";import{n as m,r as h}from"./Account-
|
|
1
|
+
import{a as e,i as t,n,t as r}from"./jsx-runtime-D3jfb0Ew.js";import{O as i,d as a,j as o,n as s,nt as c,w as l}from"./api-u3nydnnp.js";import{t as u}from"./createLucideIcon-q3MZMmnf.js";import{t as d}from"./check-CUpby_J9.js";import{n as f,t as p}from"./plus-Du-Jx8aI.js";import{n as m,r as h}from"./Account-BJPPu___.js";import{_ as g,a as _,i as v,n as y,o as b,r as x,s as S,t as C,u as w,y as T}from"./ui-gGAdXx-P.js";import{C as E,I as D,a as O,c as k,l as A,p as j,s as M,w as N,x as P}from"./index-Z0fbfnW7.js";import{n as F}from"./LocalRuntime-WHeeZvB4.js";import{t as I}from"./ImportWizard-BGs5dv94.js";var L={name:`arrow-up-right`,size:24,node:[[`path`,{d:`M7 7h10v10`,key:`1tivn9`}],[`path`,{d:`M7 17 17 7`,key:`1vkiza`}]]};L.node;var R=u(L),z=t({HomePage:()=>J,ProjectSwitcher:()=>H}),B=e(n(),1),V=e(r(),1);function H(){let{project:e,projects:t,select:n}=P(),r=N().data?.limits.projects??1,i=E(),a=c(),[o,l]=(0,B.useState)(!1),[u,d]=(0,B.useState)(``),f=D({mutationFn:()=>s.post(`/api/studio/projects`,{name:u}),onSuccess:async({id:e})=>{await a.invalidateQueries({queryKey:[`projects`]}),n(e),l(!1),d(``)}});return!e||r<=1?null:(0,V.jsxs)(`div`,{className:`flex items-center gap-2`,children:[(0,V.jsx)(w,{className:`w-56`,value:e.id,onChange:e=>e===`__new`?l(!0):n(e),options:[...t.map(e=>({value:e.id,label:e.name})),...i?[t.length<r?{value:`__new`,label:`+ ${T(`home.newProject`)}`}:{value:`__new`,label:T(`home.projectLimit`,{n:r}),disabled:!0}]:[]]}),(0,V.jsx)(v,{open:o,onClose:()=>l(!1),title:T(`home.newProject`),children:(0,V.jsxs)(`form`,{onSubmit:e=>{e.preventDefault(),u.trim()&&f.mutate()},children:[(0,V.jsx)(S,{autoFocus:!0,placeholder:T(`home.projectName`),value:u,onChange:e=>d(e.target.value)}),(0,V.jsxs)(`div`,{className:`mt-5 flex justify-end gap-2`,children:[(0,V.jsx)(C,{variant:`ghost`,onClick:()=>l(!1),children:T(`common.cancel`)}),(0,V.jsx)(C,{type:`submit`,busy:f.isPending,disabled:!u.trim(),children:T(`home.newProject`)})]})]})})]})}function U({url:e}){let[t,n]=(0,B.useState)(!1);return(0,V.jsxs)(`button`,{type:`button`,onClick:t=>{t.stopPropagation(),navigator.clipboard.writeText(e),n(!0),setTimeout(()=>n(!1),1500)},className:`inline-flex h-8 items-center gap-1.5 rounded-full px-3 text-[13px] text-ink-3 hover:bg-accent hover:text-ink`,children:[t?(0,V.jsx)(d,{className:`size-3.5`}):(0,V.jsx)(f,{className:`size-3.5`}),T(t?`share.copied`:`share.link`)]})}function W(){let e=i(),t=h(!1),[n,r]=(0,B.useState)(!1),a=(0,B.useRef)(null);return(0,B.useEffect)(()=>{if(!n)return;let e=e=>{a.current?.contains(e.target)||r(!1)},t=e=>{e.key===`Escape`&&r(!1)};return document.addEventListener(`mousedown`,e),document.addEventListener(`keydown`,t),()=>{document.removeEventListener(`mousedown`,e),document.removeEventListener(`keydown`,t)}},[n]),(0,V.jsxs)(`div`,{className:`relative`,ref:a,onClick:e=>e.stopPropagation(),children:[(0,V.jsxs)(`button`,{type:`button`,"aria-expanded":n,onClick:()=>r(e=>!e),className:`inline-flex h-8 items-center gap-1.5 rounded-full px-3 text-[13px] text-ink-3 hover:bg-accent hover:text-ink`,children:[(0,V.jsx)(f,{className:`size-3.5`}),` `,T(`share.link`)]}),n?(0,V.jsxs)(`div`,{className:`absolute right-0 bottom-10 z-20 flex w-72 animate-rise flex-col gap-3 rounded-xl bg-card p-3.5 shadow-overlay ring-1 ring-border-soft`,children:[(0,V.jsx)(`p`,{className:`text-[13px] text-ink-2 leading-relaxed`,children:T(`teaser.link`)}),(0,V.jsxs)(`div`,{className:`flex flex-wrap gap-2`,children:[(0,V.jsx)(C,{size:`sm`,busy:t.link.isPending,onClick:()=>t.link.mutate({}),children:T(`account.signIn`)}),(0,V.jsx)(C,{size:`sm`,variant:`secondary`,onClick:()=>e(`/settings/account`),children:T(`account.create`)})]}),(0,V.jsx)(m,{...t})]}):null]})}function G({w:e,me:t}){let n=i(),r=A(e,t,e.cloud),o=k(r),s=o??(e.published?M(e):null);return(0,V.jsxs)(`div`,{className:`relative pt-6`,children:[(0,V.jsx)(`div`,{className:`pointer-events-none absolute top-0 left-4 z-10`,children:(0,V.jsx)(a,{kind:e.avatar,size:52,interactive:!1})}),(0,V.jsxs)(y,{className:`relative flex h-full cursor-pointer flex-col px-5 pt-10 pb-3 transition hover:shadow-elevated`,onClick:()=>n(`/edit/${e.id}`),children:[(0,V.jsx)(`div`,{className:`absolute top-3 right-3`,children:e.published?(0,V.jsx)(O,{where:r,me:t}):(0,V.jsx)(x,{children:T(`home.draft`)})}),(0,V.jsx)(`h3`,{className:`font-display font-semibold text-[17px] leading-snug`,children:e.title}),(0,V.jsx)(`p`,{className:`mt-1 line-clamp-2 text-[14px] text-ink-3`,children:e.description}),(0,V.jsxs)(`div`,{className:`mt-auto flex min-h-8 items-center justify-between pt-3`,children:[(0,V.jsx)(`span`,{className:`text-[12px] text-ink-4`,children:T(`home.steps`,{n:e.stepCount})}),(0,V.jsxs)(`div`,{className:`flex items-center`,children:[o?(0,V.jsx)(U,{url:o}):r.kind===`here`&&j.account?(0,V.jsx)(W,{}):null,s?(0,V.jsx)(b,{label:T(o?`share.open`:`share.openHere`),className:`ml-1 size-8`,onClick:e=>{e.stopPropagation(),F(s)},children:(0,V.jsx)(R,{className:`size-4`})}):null]})]})]})]})}var K=`curl -fsSL https://engenty.ai/install.sh | bash`;function q(){let[e,t]=(0,B.useState)(!1),n=[T(`home.local.install`),T(`home.local.signIn`),T(`home.local.publish`)];return(0,V.jsxs)(`div`,{className:`mx-auto flex max-w-xl animate-rise flex-col items-center pt-4 text-center`,children:[(0,V.jsx)(a,{kind:`round`,size:120}),(0,V.jsx)(`h1`,{className:`mt-2 font-display font-semibold text-[28px] leading-tight tracking-tight`,children:T(`home.local.title`)}),(0,V.jsx)(`p`,{className:`mt-3 text-[15px] text-ink-2 leading-relaxed`,children:T(`home.local.text`)}),(0,V.jsx)(`ol`,{className:`mt-8 flex w-full flex-col gap-4 text-left`,children:n.map((n,r)=>(0,V.jsxs)(`li`,{className:`flex gap-3`,children:[(0,V.jsx)(`span`,{className:`flex size-7 shrink-0 items-center justify-center rounded-full bg-paper-2 font-medium text-[13px] text-ink-2`,children:r+1}),(0,V.jsxs)(`div`,{className:`min-w-0 flex-1 pt-0.5`,children:[(0,V.jsx)(`p`,{className:`text-[15px] leading-snug`,children:n}),r===0?(0,V.jsxs)(`div`,{className:`mt-2 flex items-center gap-2 rounded-lg bg-paper-2 py-1.5 pr-1.5 pl-3`,children:[(0,V.jsx)(`code`,{className:`min-w-0 flex-1 select-all overflow-x-auto whitespace-nowrap font-mono text-[13px] text-ink-2`,children:K}),(0,V.jsxs)(C,{variant:`secondary`,size:`sm`,onClick:()=>{navigator.clipboard.writeText(K),t(!0),setTimeout(()=>t(!1),1500)},children:[e?(0,V.jsx)(d,{className:`size-3.5`}):(0,V.jsx)(f,{className:`size-3.5`}),T(e?`share.copied`:`share.copy`)]})]}):null]})]},n))})]})}function J(){let e=i(),{project:t,projects:n,loading:r}=P(),a=N().data,c=E(),u=o({queryKey:[`wizards`,t?.id,!!a?.account],queryFn:()=>s.get(`/api/studio/projects/${t.id}/wizards`),enabled:!!t}),d=n.reduce((e,t)=>e+t.wizardCount,0),f=c&&!t?.readOnly;return!r&&f&&n.length&&d===0?(0,V.jsx)(l,{to:`/new`,replace:!0}):!r&&!c&&n.length===0?(0,V.jsx)(q,{}):(0,V.jsxs)(`div`,{className:`animate-rise`,children:[(0,V.jsxs)(`div`,{className:`flex flex-wrap items-center justify-between gap-4`,children:[(0,V.jsx)(`div`,{children:(0,V.jsx)(H,{})}),f?(0,V.jsxs)(`div`,{className:`flex items-center gap-2`,children:[(0,V.jsx)(I,{}),(0,V.jsxs)(C,{onClick:()=>e(`/new`),children:[(0,V.jsx)(p,{className:`size-4`}),` `,T(`home.new`)]})]}):null]}),(0,V.jsx)(`h1`,{className:`mt-10 font-display font-semibold text-[28px] tracking-tight`,children:T(`home.title`)}),t?.origin===`local`?(0,V.jsxs)(`p`,{className:`mt-2 text-[14px] text-ink-3`,children:[T(`home.fromLocal`),` `,t.syncedAt?T(`home.syncedAt`,{when:new Intl.DateTimeFormat(g,{dateStyle:`medium`,timeStyle:`short`}).format(new Date(t.syncedAt))}):null]}):null,u.data&&u.data.length===0?(0,V.jsx)(_,{children:T(`home.empty`)}):null,(0,V.jsx)(`div`,{className:`mt-6 grid gap-4 sm:grid-cols-2 lg:grid-cols-3`,children:a?u.data?.map(e=>(0,V.jsx)(G,{w:e,me:a},e.id)):null})]})}export{H as n,z as t};
|
|
@@ -1 +1 @@
|
|
|
1
|
-
import{a as e,n as t,t as n}from"./jsx-runtime-D3jfb0Ew.js";import{O as r,n as i,nt as a,t as o}from"./api-u3nydnnp.js";import{t as s}from"./upload-DNRENWzQ.js";import{i as c,t as l,y as u}from"./ui-gGAdXx-P.js";import{C as d,I as f,x as p}from"./index-
|
|
1
|
+
import{a as e,n as t,t as n}from"./jsx-runtime-D3jfb0Ew.js";import{O as r,n as i,nt as a,t as o}from"./api-u3nydnnp.js";import{t as s}from"./upload-DNRENWzQ.js";import{i as c,t as l,y as u}from"./ui-gGAdXx-P.js";import{C as d,I as f,x as p}from"./index-Z0fbfnW7.js";var m=e(t(),1),h=e(n(),1);function g({variant:e=`secondary`,label:t=u(`home.import`)}){let n=r(),g=a(),{project:_}=p(),v=d(),y=(0,m.useRef)(null),b=f({mutationFn:e=>i.upload(`/api/studio/projects/${_.id}/wizards/import`,e),onSuccess:async({id:e})=>{await g.invalidateQueries({queryKey:[`projects`]}),await g.invalidateQueries({queryKey:[`wizards`]}),n(`/edit/${e}`)}}),x=b.error instanceof o?b.error.body?.issues??[]:[];return!v||_?.readOnly?null:(0,h.jsxs)(h.Fragment,{children:[(0,h.jsxs)(l,{variant:e,busy:b.isPending,disabled:!_,onClick:()=>y.current?.click(),children:[(0,h.jsx)(s,{className:`size-4`}),` `,t]}),(0,h.jsx)(`input`,{ref:y,hidden:!0,type:`file`,onChange:e=>{let t=e.target.files?.[0];e.target.value=``,t&&b.mutate(t)}}),(0,h.jsxs)(c,{open:b.isError,onClose:b.reset,title:u(`import.failed`),children:[(0,h.jsx)(`p`,{className:`text-[14px] text-ink-2`,children:b.error?.message}),x.length?(0,h.jsx)(`ul`,{className:`mt-3 flex list-disc flex-col gap-1 pl-5 text-[13px] text-ink-2`,children:x.slice(0,8).map(e=>(0,h.jsx)(`li`,{children:e.message},e.message))}):null,(0,h.jsx)(`div`,{className:`mt-5 flex justify-end`,children:(0,h.jsx)(l,{variant:`secondary`,onClick:b.reset,children:u(`common.close`)})})]})]})}export{g as t};
|
|
@@ -1 +1 @@
|
|
|
1
|
-
import{a as e,n as t,t as n}from"./jsx-runtime-D3jfb0Ew.js";import{n as r,nt as i}from"./api-u3nydnnp.js";import{t as a}from"./check-CUpby_J9.js";import{c as o,s,t as c,y as l}from"./ui-gGAdXx-P.js";import{I as u}from"./index-
|
|
1
|
+
import{a as e,n as t,t as n}from"./jsx-runtime-D3jfb0Ew.js";import{n as r,nt as i}from"./api-u3nydnnp.js";import{t as a}from"./check-CUpby_J9.js";import{c as o,s,t as c,y as l}from"./ui-gGAdXx-P.js";import{I as u}from"./index-Z0fbfnW7.js";import{a as d}from"./definition-Co2Mg1qo.js";var f=e(t(),1),p=e(n(),1);function m(e){let t=window.engentyDesktop;t?t.open(e):window.open(e,`_blank`,`noopener`)}var h={gateway:`Vercel AI Gateway`,anthropic:`Anthropic`,openai:`OpenAI`};function g({models:e}){let t=i(),[n,m]=(0,f.useState)({}),[g,_]=(0,f.useState)(e.bindings),[v,y]=(0,f.useState)(e.ollamaUrl),[b,x]=(0,f.useState)(!1),S=u({mutationFn:()=>r.put(`/api/studio/local/models`,{keys:n,bindings:g,ollamaUrl:v}),onSuccess:async()=>{m({}),x(!0),setTimeout(()=>x(!1),1500),await t.invalidateQueries({queryKey:[`me`]})}});return(0,p.jsxs)(`div`,{className:`flex flex-col gap-5`,children:[(0,p.jsxs)(`div`,{children:[(0,p.jsx)(o,{children:l(`local.keys`)}),(0,p.jsx)(`p`,{className:`mb-3 text-[13px] text-ink-3`,children:l(`local.keysHint`)}),(0,p.jsx)(`div`,{className:`flex flex-col gap-2`,children:Object.keys(h).map(i=>(0,p.jsxs)(`div`,{className:`flex flex-wrap items-center gap-2`,children:[(0,p.jsx)(`span`,{className:`w-40 text-[14px] text-ink-2`,children:h[i]}),(0,p.jsx)(s,{type:`password`,autoComplete:`off`,className:`min-w-0 flex-1 font-mono text-[13px]`,placeholder:e.keys[i]?l(`local.keySet`):l(`local.keyEmpty`),value:n[i]??``,onChange:e=>m({...n,[i]:e.target.value})}),e.keys[i]?(0,p.jsx)(c,{variant:`ghost`,size:`sm`,onClick:()=>{m({...n,[i]:``}),r.put(`/api/studio/local/models`,{keys:{[i]:``}}).then(()=>t.invalidateQueries({queryKey:[`me`]}))},children:l(`local.keyRemove`)}):null]},i))})]}),(0,p.jsxs)(`div`,{children:[(0,p.jsx)(o,{children:l(`local.classes`)}),(0,p.jsx)(`p`,{className:`mb-3 text-[13px] text-ink-3`,children:l(`local.classesHint`)}),(0,p.jsxs)(`div`,{className:`flex flex-col gap-2`,children:[d.map(e=>(0,p.jsxs)(`div`,{className:`flex flex-wrap items-center gap-2`,children:[(0,p.jsx)(`span`,{className:`w-40 text-[14px] text-ink-2`,children:l(`class.${e}`)}),(0,p.jsx)(s,{className:`min-w-0 flex-1 font-mono text-[13px]`,value:g[e]??``,onChange:t=>_({...g,[e]:t.target.value})})]},e)),(0,p.jsxs)(`div`,{className:`flex flex-wrap items-center gap-2`,children:[(0,p.jsx)(`span`,{className:`w-40 text-[14px] text-ink-2`,children:`Ollama`}),(0,p.jsx)(s,{className:`min-w-0 flex-1 font-mono text-[13px]`,value:v,onChange:e=>y(e.target.value)})]})]})]}),(0,p.jsx)(`div`,{children:(0,p.jsxs)(c,{variant:`secondary`,busy:S.isPending,onClick:()=>S.mutate(),children:[b?(0,p.jsx)(a,{className:`size-4`}):null,l(b?`local.saved`:`local.save`)]})})]})}export{m as n,g as t};
|
|
@@ -1,2 +1,2 @@
|
|
|
1
|
-
const __vite__mapDeps=(i,m=__vite__mapDeps,d=(m.f||(m.f=["assets/FlowPreview-
|
|
2
|
-
import{a as e,n as t,t as n}from"./jsx-runtime-D3jfb0Ew.js";import{A as r,F as i,I as a,K as o,M as s,N as c,O as l,d as u,g as d,j as f,n as p,nt as m,w as h}from"./api-u3nydnnp.js";import{t as g}from"./preload-helper-CNEI7N0N.js";import{t as _}from"./createLucideIcon-q3MZMmnf.js";import{t as v}from"./arrow-right-6FyN3e7D.js";import{c as y,o as b,s as x,t as ee}from"./meta-DxGh33r8.js";import{t as S}from"./check-CUpby_J9.js";import{t as C}from"./chevron-down-DymW-2BP.js";import{n as w,r as te,t as T}from"./volume-2-Bp2tyaKE.js";import{n as ne,r as re}from"./upload-DNRENWzQ.js";import{n as ie,t as ae}from"./wand-sparkles-Clj3VRB5.js";import{n as E,t as oe}from"./mic-Bvz4mA2j.js";import{t as D}from"./image-BShbErBm.js";import{t as se}from"./pen-line-NK46C_nG.js";import{n as O,t as ce}from"./type-BqbppSsp.js";import{t as k}from"./video-DBmwF1Jm.js";import{l as le,u as ue}from"./engenty-Cm8yZLON.js";import{_ as A,d as j,h as M,i as de,m as fe,n as pe,r as me,t as N,y as P}from"./ui-gGAdXx-P.js";import{C as he,D as ge,E as F,I as _e,M as ve,N as I,P as ye,x as be}from"./index-Bl5vhqT3.js";import{t as xe}from"./ImportWizard-BG28_HzC.js";var Se=class extends c{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:o,isRefetching:s,isError:c,isRefetchError:l}=r,u=n.fetchMeta?.fetchMore?.direction,d=c&&u===`forward`,f=o&&u===`forward`,p=c&&u===`backward`,m=o&&u===`backward`;return{...r,fetchNextPage:this.fetchNextPage,fetchPreviousPage:this.fetchPreviousPage,hasNextPage:i(t,n.data),hasPreviousPage:a(t,n.data),isFetchNextPageError:d,isFetchingNextPage:f,isFetchPreviousPageError:p,isFetchingPreviousPage:m,isRefetchError:l&&!d&&!p,isRefetching:s&&!f&&!m}}};function Ce(e,t){return s(e,Se,t)}var we={name:`audio-lines`,size:24,node:[[`path`,{d:`M2 10v3`,key:`1fnikh`}],[`path`,{d:`M6 6v11`,key:`11sgs0`}],[`path`,{d:`M10 3v18`,key:`yhl04a`}],[`path`,{d:`M14 8v7`,key:`3a1oy3`}],[`path`,{d:`M18 5v13`,key:`123xd1`}],[`path`,{d:`M22 10v3`,key:`154ddg`}]]};we.node;var Te=_(we),Ee={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`]};Ee.node;var De=_(Ee),Oe={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`}]]};Oe.node;var ke=_(Oe),Ae={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`}]]};Ae.node;var je=_(Ae),L={name:`mouse-pointer-click`,size:24,node:[[`path`,{d:`M14 4.1 12 6`,key:`ita8i4`}],[`path`,{d:`m5.1 8-2.9-.8`,key:`1go3kf`}],[`path`,{d:`m6 12-1.9 2`,key:`mnht97`}],[`path`,{d:`M7.2 2.2 8 5.1`,key:`1cfko1`}],[`path`,{d:`M9.037 9.69a.498.498 0 0 1 .653-.653l11 4.5a.5.5 0 0 1-.074.949l-4.349 1.041a1 1 0 0 0-.74.739l-1.04 4.35a.5.5 0 0 1-.95.074z`,key:`s0h3yz`}]]};L.node;var Me=_(L),R={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`}]]};R.node;var Ne=_(R),z={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`}]]};z.node;var Pe=_(z),B={name:`terminal`,size:24,node:[[`path`,{d:`M12 19h8`,key:`baeox8`}],[`path`,{d:`m4 17 6-6-6-6`,key:`1yngyt`}]]};B.node;var Fe=_(B),V=e(t(),1),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`}},U={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`}},Ie={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`}},W={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`}},Le={low:{de:`günstig`,en:`low cost`},medium:{de:`mittel`,en:`medium cost`},high:{de:`teuer`,en:`high cost`}},G=e=>Object.keys(e);G(H),G(U),G(Ie),G(W);var K=e(n(),1),Re=(0,V.lazy)(()=>g(()=>import(`./FlowPreview-BAVCgsXg.js`),__vite__mapDeps([0,1,2,3,4,5,6,7,8,9]))),ze={useCase:``,industry:``,format:``,capability:``},q=(e,t)=>e[t]?.[A]??t;function Be(e){if(e<1)return 1;let t=10**Math.floor(Math.log10(e));return Math.round(e/t)*t}function Ve(e){return e.credits?P(`market.credits`,{n:Be(e.credits.credits)}):Le[e.costTier][A]}var He={text:ce,document:E,table:Pe,image:D,video:k,audio:Te,dashboard:De};function J({format:e,className:t}){let n=He[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 Y=[`low`,`medium`,`high`];function X({entry:e}){let t=Y.indexOf(e.costTier)+1,n=A===`de`?je:ke;return(0,K.jsxs)(`span`,{title:Ve(e),className:`inline-flex items-center gap-1`,children:[(0,K.jsx)(`span`,{"aria-hidden":`true`,className:`inline-flex shrink-0`,children:Y.slice(0,t).map((e,t)=>(0,K.jsx)(`span`,{className:M(`rounded-full bg-(--coin-bg,var(--color-card))`,t>0&&`-ml-1.5`),children:(0,K.jsx)(n,{className:`size-4`})},e))}),Le[e.costTier][A]]})}function Ue({entry:e,onOpen:t}){return(0,K.jsxs)(pe,{role:`button`,tabIndex:0,onClick:t,onKeyDown:e=>{(e.key===`Enter`||e.key===` `)&&(e.preventDefault(),t())},className:M(`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)&&`opacity-60`),children:[(0,K.jsx)(`span`,{className:`-top-4 pointer-events-none absolute right-4`,children:(0,K.jsx)(u,{kind:e.avatar,size:68,interactive:!1})}),(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-[15px]`,children:[e.title,e.starred?(0,K.jsx)(O,{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-[13px] text-ink-3 leading-snug`,children:e.pitch})]}),(0,K.jsx)(`div`,{className:`mt-auto flex flex-wrap items-center gap-x-3 gap-y-1.5 text-[12px] text-ink-3`,children:e.usable&&e.missing.length?(0,K.jsx)(me,{tone:`warn`,children:P(`market.missing`,{list:We(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)(I,{className:`size-3.5`}),` `,P(`market.minutes`,{n:e.effort.minutes})]}),(0,K.jsx)(X,{entry:e}),(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)(me,{tone:`warn`,children:P(`market.needsUpdate`)})})]})}function Z({title:e,children:t}){return(0,K.jsxs)(`div`,{children:[(0,K.jsx)(`div`,{className:`mb-1.5 font-medium text-[12px] text-ink-3 uppercase tracking-[0.06em]`,children:e}),t]})}var We=e=>e.map(e=>q(W,e)).join(`, `),Ge={text:se,web:w,browser:Me,documents:Ne,image:D,video:k,speech:T,listening:oe,code:Fe,connectors:ge};function Ke(e){switch(e.type){case`page`:return b;case`agent`:return y;case`generate`:return e.asset===`image`?D:e.asset===`video`?k:e.asset===`voice`?T:e.asset===`dashboard`?De:E;case`widget`:return e.video?te:ye;case`review`:return ie;case`result`:return x}return ae}function qe(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 Je(e){let t=qe(e);return e.map(e=>({id:e.id,title:e.title,icon:Ke(e),tone:ee[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-[14px] text-ink leading-snug`,children:t}),n?(0,K.jsx)(`div`,{className:`text-[12px] text-ink-3 leading-snug`,children:n}):null]})]})}function Ye({className:e,children:t}){let n=(0,V.useRef)(null),[r,i]=(0,V.useState)({above:!1,below:!1});(0,V.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 Xe({id:e,fallback:t,onClose:n,onUse:r,busy:i}){let a=m(),o=l(),s=f({queryKey:[`marketplace-entry`,e,A],queryFn:()=>p.get(`/api/studio/marketplace/${encodeURIComponent(e)}?lang=${A}`),enabled:!!e,retry:!1}),c=s.data??t,h=_e({mutationFn:t=>{let n=`/api/studio/marketplace/${encodeURIComponent(e)}/star`;return t?p.put(n):p.del(n)},onSuccess:()=>Promise.all([a.invalidateQueries({queryKey:[`marketplace`]}),a.invalidateQueries({queryKey:[`marketplace-entry`,e]})])}),g=d()===`dark`,_=le[ue[c?.avatar||`round`]],v=g?`var(--card)`:`color-mix(in oklch, ${_??`var(--ink-4)`} 14%, var(--paper-2))`;return(0,K.jsx)(de,{open:!!e,onClose:n,wide:!0,bare:!0,children:c?(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)(F,{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:v,"--coin-bg":v},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:M(`-top-28 -right-10 absolute size-80 rounded-full bg-white blur-3xl`,g?`opacity-[0.14]`:`opacity-80`)})}),(0,K.jsx)(`div`,{className:`-bottom-5 absolute right-9 z-10 max-sm:hidden`,children:(0,K.jsx)(u,{kind:c.avatar,size:104})}),(0,K.jsxs)(`div`,{className:`relative sm:pr-36`,children:[(0,K.jsx)(`h2`,{className:`font-display font-semibold text-[22px] leading-tight tracking-tight max-sm:pr-10`,children:c.title}),(0,K.jsx)(`p`,{className:`mt-1 text-[14px] text-ink-2 leading-snug`,children:s.data?.description||c.pitch})]}),c.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-[14px] sm:px-7 sm:pr-40`,children:[(0,K.jsxs)(Q,{title:P(`market.duration`),children:[(0,K.jsx)(I,{className:`size-4 text-ink-3`}),P(`market.minutes`,{n:c.effort.minutes})]}),(0,K.jsx)(Q,{title:P(`market.cost`),children:(0,K.jsx)(X,{entry:c})}),(0,K.jsx)(Q,{title:P(`market.result`),children:c.formats.map(e=>(0,K.jsx)(J,{format:e,className:`size-4`},e))})]}):null]}),c.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)(Z,{title:P(`market.duration`),children:(0,K.jsx)($,{icon:(0,K.jsx)(I,{className:`size-4 text-moss`}),more:P(`market.durationHint`,{n:c.effort.fields}),children:P(`market.minutes`,{n:c.effort.minutes})})}),(0,K.jsx)(Z,{title:P(`market.cost`),children:(0,K.jsx)($,{icon:(0,K.jsx)(re,{className:`size-4 text-amber`}),more:c.credits?P(`market.creditsHint`):void 0,children:(0,K.jsxs)(`span`,{className:`flex flex-wrap items-center gap-x-2`,children:[(0,K.jsx)(X,{entry:c}),c.credits?(0,K.jsx)(`span`,{className:`text-ink-2`,children:P(`market.creditsRange`,{n:Be(c.credits.credits)})}):null]})})}),(0,K.jsx)(Z,{title:P(`market.result`),children:(0,K.jsx)(`div`,{className:`flex flex-col gap-2`,children:(s.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)(Z,{title:P(`market.needs`),children:(0,K.jsx)(`ul`,{className:`flex flex-col gap-2`,children:c.capabilities.map(e=>{let t=Ge[e],n=c.missing.includes(e);return(0,K.jsxs)(`li`,{className:M(`flex items-center gap-2.5 text-[14px]`,n?`text-ink-3`:`text-ink-2`),children:[(0,K.jsx)(t,{className:M(`size-4 shrink-0`,n?`text-rose`:`text-cobalt`)}),q(W,e),n?(0,K.jsx)(`span`,{className:`text-[12px] text-rose`,children:P(`market.unavailable`)}):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-[12px] text-ink-3 uppercase tracking-[0.06em]`,children:P(`market.steps`)}),(0,K.jsx)(Ye,{className:`-mr-2 overscroll-contain pt-1 pr-2 pl-1 sm:min-h-0 sm:flex-1 sm:overflow-y-auto`,children:s.isLoading?(0,K.jsx)(j,{className:`size-5 text-ink-3`}):(0,K.jsx)(V.Suspense,{fallback:(0,K.jsx)(j,{className:`size-5 text-ink-3`}),children:(0,K.jsx)(Re,{steps:Je(s.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-[14px] 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:[(0,K.jsxs)(N,{variant:`ghost`,className:`mr-auto`,title:P(`market.starHint`),"aria-pressed":c.starred,busy:h.isPending,onClick:()=>h.mutate(!c.starred),children:[(0,K.jsx)(O,{className:M(`size-4`,c.starred&&`fill-amber text-amber`)}),(0,K.jsx)(`span`,{className:`max-sm:sr-only`,children:P(c.starred?`market.starred`:`market.star`)})]}),(0,K.jsx)(N,{variant:`secondary`,onClick:n,children:P(`common.close`)}),c.usable&&c.missing.length?(0,K.jsx)(N,{variant:`secondary`,onClick:()=>o(`/settings/models`),children:P(`editor.models.settings`)}):null,r?(0,K.jsx)(N,{disabled:!c.usable||c.missing.length>0,title:c.missing.length?P(`market.missingHint`,{list:We(c.missing)}):void 0,busy:i,onClick:()=>r(c),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-[14px] text-ink-2 shadow-overlay`,children:s.isLoading?(0,K.jsx)(j,{className:`size-6 text-ink-3`}):(0,K.jsxs)(K.Fragment,{children:[(0,K.jsx)(`p`,{children:P(`market.notFound`)}),(0,K.jsx)(N,{variant:`secondary`,onClick:n,children:P(`common.close`)})]})})})}function Ze({name:e,value:t,options:n,onChange:r}){let[i,a]=(0,V.useState)(!1),o=(0,V.useRef)(null);(0,V.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:M(`flex h-8 items-center rounded-full text-[13px] 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:M(`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)(C,{className:M(`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)(F,{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:M(`flex w-full items-center gap-2.5 rounded-lg px-2.5 py-2 text-left text-[14px] 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)(S,{className:`size-4 text-ember`}):e.unavailable?(0,K.jsx)(`span`,{className:`whitespace-nowrap text-[12px] text-ink-4`,children:P(`market.unavailable`)}):(0,K.jsx)(`span`,{className:`text-[12px] text-ink-4 tabular-nums`,children:e.count})]},e.value))}):null]})}function Qe(e,t){let[n,r]=(0,V.useState)(e);return(0,V.useEffect)(()=>{let n=setTimeout(()=>r(e),t);return()=>clearTimeout(n)},[e,t]),n}var $e=60;function et({onUse:e,busy:t,open:n}){let[r,i]=(0,V.useState)(``),[a,s]=(0,V.useState)(ze),[c,l]=(0,V.useState)(!1),[u,d]=(0,V.useState)(n??null),f=Qe(r.trim(),250),m=Ce({queryKey:[`marketplace`,A,f,a,c],queryFn:({pageParam:e})=>{let t=new URLSearchParams({lang:A,limit:String($e),offset:String(e)});f&&t.set(`q`,f);for(let[e,n]of Object.entries(a))n&&t.set(e,n);return c&&t.set(`starred`,`1`),p.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:o}),h=m.data?.pages[0],g=m.data?.pages.flatMap(e=>e.entries)??[],_=h?.all??0,v=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`&&b.has(r)})),b=new Set(h?.unavailable??[]),x=y(`useCase`,Ie),ee=[{key:`industry`,name:P(`market.industry`),options:y(`industry`,U)},{key:`format`,name:P(`market.format`),options:y(`format`,H,e=>(0,K.jsx)(J,{format:e,className:`size-4 text-ink-3`}))},{key:`capability`,name:P(`market.capability`),options:y(`capability`,W,e=>{let t=Ge[e];return(0,K.jsx)(t,{className:`size-4 text-ink-3`})})}],S=!!r.trim()||c||Object.values(a).some(Boolean),C=()=>{s(ze),i(``),l(!1)};if(m.isLoading)return(0,K.jsx)(`div`,{className:`flex justify-center py-10`,children:(0,K.jsx)(j,{className:`size-6 text-ink-3`})});let w=h?.offline?(0,K.jsxs)(`p`,{className:`mt-4 flex items-center justify-center gap-2 text-[13px] text-ink-3`,children:[(0,K.jsx)(ve,{className:`size-4 shrink-0`}),P(`market.offline`)]}):null;if(!_&&!S)return w;let te=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)(F,{className:`size-4`})}):null,T=e=>M(`inline-flex h-7 shrink-0 items-center gap-1 whitespace-nowrap rounded-full px-2.5 text-[12.5px] 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:[v?(0,K.jsx)(j,{className:`size-4 shrink-0 text-ink-3`}):(0,K.jsx)(ne,{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-[15px] outline-none placeholder:text-ink-4 [&::-webkit-search-cancel-button]:hidden`}),te]}),w,(0,K.jsxs)(`div`,{className:`max-sm:-mx-4 mt-4 flex gap-1 max-sm:overflow-x-auto max-sm:px-4 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":!c&&a.useCase===e.value,onClick:()=>{l(!1),s({...a,useCase:e.value})},className:T(!c&&a.useCase===e.value),children:e.label},e.value)),(0,K.jsxs)(`button`,{type:`button`,"aria-pressed":c,onClick:()=>l(!c),className:T(c),children:[(0,K.jsx)(O,{className:M(`size-3.5`,c&&`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:[c?null:ee.map(e=>(0,K.jsx)(Ze,{name:e.name,value:a[e.key],options:e.options,onChange:t=>s({...a,[e.key]:t})},e.key)),(0,K.jsxs)(`span`,{className:`ml-auto flex items-center gap-3 whitespace-nowrap pl-2 text-[13px] 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)(F,{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:M(`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)(Ue,{entry:e,onOpen:()=>d(e.id)},e.id))}):(0,K.jsxs)(`div`,{className:`py-10 text-center text-[14px] text-ink-3`,children:[(0,K.jsx)(`p`,{children:P(c?`market.noneStarred`:`market.none`)}),(0,K.jsx)(N,{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)(N,{variant:`secondary`,busy:m.isFetchingNextPage,onClick:()=>void m.fetchNextPage(),children:P(`market.more`)})}):null,(0,K.jsx)(Xe,{id:u,fallback:g.find(e=>e.id===u)??null,onClose:()=>d(null),onUse:e,busy:t})]})}var tt={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 nt(){let e=l(),t=m(),{project:n}=be(),i=he(),[a,o]=(0,V.useState)(``),[s]=r(),c=_e({mutationFn:e=>p.post(`/api/studio/wizards`,{projectId:n.id,starterId:e,lang:A}),onSuccess:async({id:n},r)=>{await t.invalidateQueries({queryKey:[`projects`]}),await t.invalidateQueries({queryKey:[`wizards`]}),e(r?`/edit/${n}`:`/edit/${n}?prompt=${encodeURIComponent(a.trim())}`)}}),d=()=>{a.trim()&&n&&c.mutate(void 0)};return!i||n?.readOnly?(0,K.jsx)(h,{to:`/`,replace:!0}):(0,K.jsxs)(`div`,{className:`animate-rise pt-4`,children:[(0,K.jsxs)(`div`,{className:`mx-auto max-w-2xl`,children:[(0,K.jsxs)(`div`,{className:`flex flex-col items-center text-center`,children:[(0,K.jsx)(u,{kind:`sprout`,size:150,fluffy:!0}),(0,K.jsx)(`h1`,{className:`mt-2 font-display font-semibold text-[32px] leading-tight tracking-tight sm:text-[38px]`,children:P(`new.title`)})]}),(0,K.jsxs)(`div`,{className:`mt-8 rounded-2xl bg-card p-2 shadow-elevated ring-1 ring-border-soft focus-within:ring-focus`,children:[(0,K.jsx)(fe,{autoFocus:!0,minRows:4,value:a,onChange:e=>o(e.target.value),onKeyDown:e=>{e.key===`Enter`&&(e.metaKey||e.ctrlKey)&&d()},placeholder:P(`new.placeholder`),className:`border-0 bg-transparent text-[16px] shadow-none focus:ring-0`}),(0,K.jsxs)(`div`,{className:`flex items-center justify-between gap-3 px-2 pb-1`,children:[(0,K.jsx)(`span`,{className:`hidden text-[12px] text-ink-4 sm:block`,children:P(`new.hint`)}),(0,K.jsxs)(N,{size:`md`,onClick:d,busy:c.isPending&&!c.variables,disabled:!a.trim(),children:[P(`new.build`),` `,(0,K.jsx)(v,{className:`size-4`})]})]})]}),(0,K.jsx)(`div`,{className:`mt-4 flex flex-wrap justify-center gap-2`,children:tt[A].map(e=>(0,K.jsx)(`button`,{type:`button`,onClick:()=>o(e),className:`rounded-full bg-paper-2 px-3.5 py-1.5 text-[13px] text-ink-2 transition hover:bg-paper-3 hover:text-ink`,children:e},e))})]}),(0,K.jsxs)(`section`,{className:`mx-auto max-w-5xl`,children:[(0,K.jsx)(`h2`,{className:`mt-16 mb-5 text-center font-medium text-[13px] text-ink-3 uppercase tracking-[0.08em]`,children:P(`new.orStarter`)}),(0,K.jsx)(et,{open:s.get(`starter`),busy:c.isPending&&!!c.variables,onUse:e=>n&&!c.isPending&&c.mutate(e.id)}),c.error?(0,K.jsx)(`p`,{className:`mt-3 text-center text-[14px] text-rose`,children:c.error.message}):null]}),(0,K.jsx)(`div`,{className:`mt-8 flex justify-center`,children:(0,K.jsx)(xe,{variant:`ghost`,label:P(`new.import`)})})]})}export{nt as NewWizardPage};
|
|
1
|
+
const __vite__mapDeps=(i,m=__vite__mapDeps,d=(m.f||(m.f=["assets/FlowPreview-4cRsWwO8.js","assets/jsx-runtime-D3jfb0Ew.js","assets/ui-gGAdXx-P.js","assets/esm-CyCiCaFy.js","assets/index-Z0fbfnW7.js","assets/api-u3nydnnp.js","assets/preload-helper-CNEI7N0N.js","assets/createLucideIcon-q3MZMmnf.js","assets/engenty-Cm8yZLON.js","assets/index-CQQD8QNR.css"])))=>i.map(i=>d[i]);
|
|
2
|
+
import{a as e,n as t,t as n}from"./jsx-runtime-D3jfb0Ew.js";import{A as r,F as i,I as a,K as o,M as s,N as c,O as l,d as u,g as d,j as f,n as p,nt as m,w as h}from"./api-u3nydnnp.js";import{t as g}from"./preload-helper-CNEI7N0N.js";import{t as _}from"./createLucideIcon-q3MZMmnf.js";import{t as v}from"./arrow-right-6FyN3e7D.js";import{c as y,o as b,s as x,t as ee}from"./meta-DsCJykuf.js";import{t as S}from"./check-CUpby_J9.js";import{t as C}from"./chevron-down-DymW-2BP.js";import{n as w,r as te,t as T}from"./volume-2-Bp2tyaKE.js";import{n as ne,r as re}from"./upload-DNRENWzQ.js";import{n as ie,t as ae}from"./wand-sparkles-Clj3VRB5.js";import{n as E,t as oe}from"./mic-Bvz4mA2j.js";import{t as D}from"./image-BShbErBm.js";import{t as se}from"./pen-line-NK46C_nG.js";import{n as O,t as ce}from"./type-BqbppSsp.js";import{t as k}from"./video-DBmwF1Jm.js";import{l as le,u as ue}from"./engenty-Cm8yZLON.js";import{_ as A,d as j,h as M,i as de,m as fe,n as pe,r as me,t as N,y as P}from"./ui-gGAdXx-P.js";import{C as he,D as ge,E as F,I as _e,M as ve,N as I,P as ye,x as be}from"./index-Z0fbfnW7.js";import{t as xe}from"./ImportWizard-BGs5dv94.js";var Se=class extends c{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:o,isRefetching:s,isError:c,isRefetchError:l}=r,u=n.fetchMeta?.fetchMore?.direction,d=c&&u===`forward`,f=o&&u===`forward`,p=c&&u===`backward`,m=o&&u===`backward`;return{...r,fetchNextPage:this.fetchNextPage,fetchPreviousPage:this.fetchPreviousPage,hasNextPage:i(t,n.data),hasPreviousPage:a(t,n.data),isFetchNextPageError:d,isFetchingNextPage:f,isFetchPreviousPageError:p,isFetchingPreviousPage:m,isRefetchError:l&&!d&&!p,isRefetching:s&&!f&&!m}}};function Ce(e,t){return s(e,Se,t)}var we={name:`audio-lines`,size:24,node:[[`path`,{d:`M2 10v3`,key:`1fnikh`}],[`path`,{d:`M6 6v11`,key:`11sgs0`}],[`path`,{d:`M10 3v18`,key:`yhl04a`}],[`path`,{d:`M14 8v7`,key:`3a1oy3`}],[`path`,{d:`M18 5v13`,key:`123xd1`}],[`path`,{d:`M22 10v3`,key:`154ddg`}]]};we.node;var Te=_(we),Ee={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`]};Ee.node;var De=_(Ee),Oe={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`}]]};Oe.node;var ke=_(Oe),Ae={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`}]]};Ae.node;var je=_(Ae),L={name:`mouse-pointer-click`,size:24,node:[[`path`,{d:`M14 4.1 12 6`,key:`ita8i4`}],[`path`,{d:`m5.1 8-2.9-.8`,key:`1go3kf`}],[`path`,{d:`m6 12-1.9 2`,key:`mnht97`}],[`path`,{d:`M7.2 2.2 8 5.1`,key:`1cfko1`}],[`path`,{d:`M9.037 9.69a.498.498 0 0 1 .653-.653l11 4.5a.5.5 0 0 1-.074.949l-4.349 1.041a1 1 0 0 0-.74.739l-1.04 4.35a.5.5 0 0 1-.95.074z`,key:`s0h3yz`}]]};L.node;var Me=_(L),R={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`}]]};R.node;var Ne=_(R),z={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`}]]};z.node;var Pe=_(z),B={name:`terminal`,size:24,node:[[`path`,{d:`M12 19h8`,key:`baeox8`}],[`path`,{d:`m4 17 6-6-6-6`,key:`1yngyt`}]]};B.node;var Fe=_(B),V=e(t(),1),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`}},U={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`}},Ie={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`}},W={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`}},Le={low:{de:`günstig`,en:`low cost`},medium:{de:`mittel`,en:`medium cost`},high:{de:`teuer`,en:`high cost`}},G=e=>Object.keys(e);G(H),G(U),G(Ie),G(W);var K=e(n(),1),Re=(0,V.lazy)(()=>g(()=>import(`./FlowPreview-4cRsWwO8.js`),__vite__mapDeps([0,1,2,3,4,5,6,7,8,9]))),ze={useCase:``,industry:``,format:``,capability:``},q=(e,t)=>e[t]?.[A]??t;function Be(e){if(e<1)return 1;let t=10**Math.floor(Math.log10(e));return Math.round(e/t)*t}function Ve(e){return e.credits?P(`market.credits`,{n:Be(e.credits.credits)}):Le[e.costTier][A]}var He={text:ce,document:E,table:Pe,image:D,video:k,audio:Te,dashboard:De};function J({format:e,className:t}){let n=He[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 Y=[`low`,`medium`,`high`];function X({entry:e}){let t=Y.indexOf(e.costTier)+1,n=A===`de`?je:ke;return(0,K.jsxs)(`span`,{title:Ve(e),className:`inline-flex items-center gap-1`,children:[(0,K.jsx)(`span`,{"aria-hidden":`true`,className:`inline-flex shrink-0`,children:Y.slice(0,t).map((e,t)=>(0,K.jsx)(`span`,{className:M(`rounded-full bg-(--coin-bg,var(--color-card))`,t>0&&`-ml-1.5`),children:(0,K.jsx)(n,{className:`size-4`})},e))}),Le[e.costTier][A]]})}function Ue({entry:e,onOpen:t}){return(0,K.jsxs)(pe,{role:`button`,tabIndex:0,onClick:t,onKeyDown:e=>{(e.key===`Enter`||e.key===` `)&&(e.preventDefault(),t())},className:M(`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)&&`opacity-60`),children:[(0,K.jsx)(`span`,{className:`-top-4 pointer-events-none absolute right-4`,children:(0,K.jsx)(u,{kind:e.avatar,size:68,interactive:!1})}),(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-[15px]`,children:[e.title,e.starred?(0,K.jsx)(O,{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-[13px] text-ink-3 leading-snug`,children:e.pitch})]}),(0,K.jsx)(`div`,{className:`mt-auto flex flex-wrap items-center gap-x-3 gap-y-1.5 text-[12px] text-ink-3`,children:e.usable&&e.missing.length?(0,K.jsx)(me,{tone:`warn`,children:P(`market.missing`,{list:We(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)(I,{className:`size-3.5`}),` `,P(`market.minutes`,{n:e.effort.minutes})]}),(0,K.jsx)(X,{entry:e}),(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)(me,{tone:`warn`,children:P(`market.needsUpdate`)})})]})}function Z({title:e,children:t}){return(0,K.jsxs)(`div`,{children:[(0,K.jsx)(`div`,{className:`mb-1.5 font-medium text-[12px] text-ink-3 uppercase tracking-[0.06em]`,children:e}),t]})}var We=e=>e.map(e=>q(W,e)).join(`, `),Ge={text:se,web:w,browser:Me,documents:Ne,image:D,video:k,speech:T,listening:oe,code:Fe,connectors:ge};function Ke(e){switch(e.type){case`page`:return b;case`agent`:return y;case`generate`:return e.asset===`image`?D:e.asset===`video`?k:e.asset===`voice`?T:e.asset===`dashboard`?De:E;case`widget`:return e.video?te:ye;case`review`:return ie;case`result`:return x}return ae}function qe(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 Je(e){let t=qe(e);return e.map(e=>({id:e.id,title:e.title,icon:Ke(e),tone:ee[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-[14px] text-ink leading-snug`,children:t}),n?(0,K.jsx)(`div`,{className:`text-[12px] text-ink-3 leading-snug`,children:n}):null]})]})}function Ye({className:e,children:t}){let n=(0,V.useRef)(null),[r,i]=(0,V.useState)({above:!1,below:!1});(0,V.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 Xe({id:e,fallback:t,onClose:n,onUse:r,busy:i}){let a=m(),o=l(),s=f({queryKey:[`marketplace-entry`,e,A],queryFn:()=>p.get(`/api/studio/marketplace/${encodeURIComponent(e)}?lang=${A}`),enabled:!!e,retry:!1}),c=s.data??t,h=_e({mutationFn:t=>{let n=`/api/studio/marketplace/${encodeURIComponent(e)}/star`;return t?p.put(n):p.del(n)},onSuccess:()=>Promise.all([a.invalidateQueries({queryKey:[`marketplace`]}),a.invalidateQueries({queryKey:[`marketplace-entry`,e]})])}),g=d()===`dark`,_=le[ue[c?.avatar||`round`]],v=g?`var(--card)`:`color-mix(in oklch, ${_??`var(--ink-4)`} 14%, var(--paper-2))`;return(0,K.jsx)(de,{open:!!e,onClose:n,wide:!0,bare:!0,children:c?(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)(F,{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:v,"--coin-bg":v},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:M(`-top-28 -right-10 absolute size-80 rounded-full bg-white blur-3xl`,g?`opacity-[0.14]`:`opacity-80`)})}),(0,K.jsx)(`div`,{className:`-bottom-5 absolute right-9 z-10 max-sm:hidden`,children:(0,K.jsx)(u,{kind:c.avatar,size:104})}),(0,K.jsxs)(`div`,{className:`relative sm:pr-36`,children:[(0,K.jsx)(`h2`,{className:`font-display font-semibold text-[22px] leading-tight tracking-tight max-sm:pr-10`,children:c.title}),(0,K.jsx)(`p`,{className:`mt-1 text-[14px] text-ink-2 leading-snug`,children:s.data?.description||c.pitch})]}),c.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-[14px] sm:px-7 sm:pr-40`,children:[(0,K.jsxs)(Q,{title:P(`market.duration`),children:[(0,K.jsx)(I,{className:`size-4 text-ink-3`}),P(`market.minutes`,{n:c.effort.minutes})]}),(0,K.jsx)(Q,{title:P(`market.cost`),children:(0,K.jsx)(X,{entry:c})}),(0,K.jsx)(Q,{title:P(`market.result`),children:c.formats.map(e=>(0,K.jsx)(J,{format:e,className:`size-4`},e))})]}):null]}),c.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)(Z,{title:P(`market.duration`),children:(0,K.jsx)($,{icon:(0,K.jsx)(I,{className:`size-4 text-moss`}),more:P(`market.durationHint`,{n:c.effort.fields}),children:P(`market.minutes`,{n:c.effort.minutes})})}),(0,K.jsx)(Z,{title:P(`market.cost`),children:(0,K.jsx)($,{icon:(0,K.jsx)(re,{className:`size-4 text-amber`}),more:c.credits?P(`market.creditsHint`):void 0,children:(0,K.jsxs)(`span`,{className:`flex flex-wrap items-center gap-x-2`,children:[(0,K.jsx)(X,{entry:c}),c.credits?(0,K.jsx)(`span`,{className:`text-ink-2`,children:P(`market.creditsRange`,{n:Be(c.credits.credits)})}):null]})})}),(0,K.jsx)(Z,{title:P(`market.result`),children:(0,K.jsx)(`div`,{className:`flex flex-col gap-2`,children:(s.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)(Z,{title:P(`market.needs`),children:(0,K.jsx)(`ul`,{className:`flex flex-col gap-2`,children:c.capabilities.map(e=>{let t=Ge[e],n=c.missing.includes(e);return(0,K.jsxs)(`li`,{className:M(`flex items-center gap-2.5 text-[14px]`,n?`text-ink-3`:`text-ink-2`),children:[(0,K.jsx)(t,{className:M(`size-4 shrink-0`,n?`text-rose`:`text-cobalt`)}),q(W,e),n?(0,K.jsx)(`span`,{className:`text-[12px] text-rose`,children:P(`market.unavailable`)}):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-[12px] text-ink-3 uppercase tracking-[0.06em]`,children:P(`market.steps`)}),(0,K.jsx)(Ye,{className:`-mr-2 overscroll-contain pt-1 pr-2 pl-1 sm:min-h-0 sm:flex-1 sm:overflow-y-auto`,children:s.isLoading?(0,K.jsx)(j,{className:`size-5 text-ink-3`}):(0,K.jsx)(V.Suspense,{fallback:(0,K.jsx)(j,{className:`size-5 text-ink-3`}),children:(0,K.jsx)(Re,{steps:Je(s.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-[14px] 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:[(0,K.jsxs)(N,{variant:`ghost`,className:`mr-auto`,title:P(`market.starHint`),"aria-pressed":c.starred,busy:h.isPending,onClick:()=>h.mutate(!c.starred),children:[(0,K.jsx)(O,{className:M(`size-4`,c.starred&&`fill-amber text-amber`)}),(0,K.jsx)(`span`,{className:`max-sm:sr-only`,children:P(c.starred?`market.starred`:`market.star`)})]}),(0,K.jsx)(N,{variant:`secondary`,onClick:n,children:P(`common.close`)}),c.usable&&c.missing.length?(0,K.jsx)(N,{variant:`secondary`,onClick:()=>o(`/settings/models`),children:P(`editor.models.settings`)}):null,r?(0,K.jsx)(N,{disabled:!c.usable||c.missing.length>0,title:c.missing.length?P(`market.missingHint`,{list:We(c.missing)}):void 0,busy:i,onClick:()=>r(c),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-[14px] text-ink-2 shadow-overlay`,children:s.isLoading?(0,K.jsx)(j,{className:`size-6 text-ink-3`}):(0,K.jsxs)(K.Fragment,{children:[(0,K.jsx)(`p`,{children:P(`market.notFound`)}),(0,K.jsx)(N,{variant:`secondary`,onClick:n,children:P(`common.close`)})]})})})}function Ze({name:e,value:t,options:n,onChange:r}){let[i,a]=(0,V.useState)(!1),o=(0,V.useRef)(null);(0,V.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:M(`flex h-8 items-center rounded-full text-[13px] 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:M(`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)(C,{className:M(`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)(F,{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:M(`flex w-full items-center gap-2.5 rounded-lg px-2.5 py-2 text-left text-[14px] 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)(S,{className:`size-4 text-ember`}):e.unavailable?(0,K.jsx)(`span`,{className:`whitespace-nowrap text-[12px] text-ink-4`,children:P(`market.unavailable`)}):(0,K.jsx)(`span`,{className:`text-[12px] text-ink-4 tabular-nums`,children:e.count})]},e.value))}):null]})}function Qe(e,t){let[n,r]=(0,V.useState)(e);return(0,V.useEffect)(()=>{let n=setTimeout(()=>r(e),t);return()=>clearTimeout(n)},[e,t]),n}var $e=60;function et({onUse:e,busy:t,open:n}){let[r,i]=(0,V.useState)(``),[a,s]=(0,V.useState)(ze),[c,l]=(0,V.useState)(!1),[u,d]=(0,V.useState)(n??null),f=Qe(r.trim(),250),m=Ce({queryKey:[`marketplace`,A,f,a,c],queryFn:({pageParam:e})=>{let t=new URLSearchParams({lang:A,limit:String($e),offset:String(e)});f&&t.set(`q`,f);for(let[e,n]of Object.entries(a))n&&t.set(e,n);return c&&t.set(`starred`,`1`),p.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:o}),h=m.data?.pages[0],g=m.data?.pages.flatMap(e=>e.entries)??[],_=h?.all??0,v=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`&&b.has(r)})),b=new Set(h?.unavailable??[]),x=y(`useCase`,Ie),ee=[{key:`industry`,name:P(`market.industry`),options:y(`industry`,U)},{key:`format`,name:P(`market.format`),options:y(`format`,H,e=>(0,K.jsx)(J,{format:e,className:`size-4 text-ink-3`}))},{key:`capability`,name:P(`market.capability`),options:y(`capability`,W,e=>{let t=Ge[e];return(0,K.jsx)(t,{className:`size-4 text-ink-3`})})}],S=!!r.trim()||c||Object.values(a).some(Boolean),C=()=>{s(ze),i(``),l(!1)};if(m.isLoading)return(0,K.jsx)(`div`,{className:`flex justify-center py-10`,children:(0,K.jsx)(j,{className:`size-6 text-ink-3`})});let w=h?.offline?(0,K.jsxs)(`p`,{className:`mt-4 flex items-center justify-center gap-2 text-[13px] text-ink-3`,children:[(0,K.jsx)(ve,{className:`size-4 shrink-0`}),P(`market.offline`)]}):null;if(!_&&!S)return w;let te=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)(F,{className:`size-4`})}):null,T=e=>M(`inline-flex h-7 shrink-0 items-center gap-1 whitespace-nowrap rounded-full px-2.5 text-[12.5px] 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:[v?(0,K.jsx)(j,{className:`size-4 shrink-0 text-ink-3`}):(0,K.jsx)(ne,{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-[15px] outline-none placeholder:text-ink-4 [&::-webkit-search-cancel-button]:hidden`}),te]}),w,(0,K.jsxs)(`div`,{className:`max-sm:-mx-4 mt-4 flex gap-1 max-sm:overflow-x-auto max-sm:px-4 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":!c&&a.useCase===e.value,onClick:()=>{l(!1),s({...a,useCase:e.value})},className:T(!c&&a.useCase===e.value),children:e.label},e.value)),(0,K.jsxs)(`button`,{type:`button`,"aria-pressed":c,onClick:()=>l(!c),className:T(c),children:[(0,K.jsx)(O,{className:M(`size-3.5`,c&&`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:[c?null:ee.map(e=>(0,K.jsx)(Ze,{name:e.name,value:a[e.key],options:e.options,onChange:t=>s({...a,[e.key]:t})},e.key)),(0,K.jsxs)(`span`,{className:`ml-auto flex items-center gap-3 whitespace-nowrap pl-2 text-[13px] 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)(F,{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:M(`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)(Ue,{entry:e,onOpen:()=>d(e.id)},e.id))}):(0,K.jsxs)(`div`,{className:`py-10 text-center text-[14px] text-ink-3`,children:[(0,K.jsx)(`p`,{children:P(c?`market.noneStarred`:`market.none`)}),(0,K.jsx)(N,{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)(N,{variant:`secondary`,busy:m.isFetchingNextPage,onClick:()=>void m.fetchNextPage(),children:P(`market.more`)})}):null,(0,K.jsx)(Xe,{id:u,fallback:g.find(e=>e.id===u)??null,onClose:()=>d(null),onUse:e,busy:t})]})}var tt={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 nt(){let e=l(),t=m(),{project:n}=be(),i=he(),[a,o]=(0,V.useState)(``),[s]=r(),c=_e({mutationFn:e=>p.post(`/api/studio/wizards`,{projectId:n.id,starterId:e,lang:A}),onSuccess:async({id:n},r)=>{await t.invalidateQueries({queryKey:[`projects`]}),await t.invalidateQueries({queryKey:[`wizards`]}),e(r?`/edit/${n}`:`/edit/${n}?prompt=${encodeURIComponent(a.trim())}`)}}),d=()=>{a.trim()&&n&&c.mutate(void 0)};return!i||n?.readOnly?(0,K.jsx)(h,{to:`/`,replace:!0}):(0,K.jsxs)(`div`,{className:`animate-rise pt-4`,children:[(0,K.jsxs)(`div`,{className:`mx-auto max-w-2xl`,children:[(0,K.jsxs)(`div`,{className:`flex flex-col items-center text-center`,children:[(0,K.jsx)(u,{kind:`sprout`,size:150,fluffy:!0}),(0,K.jsx)(`h1`,{className:`mt-2 font-display font-semibold text-[32px] leading-tight tracking-tight sm:text-[38px]`,children:P(`new.title`)})]}),(0,K.jsxs)(`div`,{className:`mt-8 rounded-2xl bg-card p-2 shadow-elevated ring-1 ring-border-soft focus-within:ring-focus`,children:[(0,K.jsx)(fe,{autoFocus:!0,minRows:4,value:a,onChange:e=>o(e.target.value),onKeyDown:e=>{e.key===`Enter`&&(e.metaKey||e.ctrlKey)&&d()},placeholder:P(`new.placeholder`),className:`border-0 bg-transparent text-[16px] shadow-none focus:ring-0`}),(0,K.jsxs)(`div`,{className:`flex items-center justify-between gap-3 px-2 pb-1`,children:[(0,K.jsx)(`span`,{className:`hidden text-[12px] text-ink-4 sm:block`,children:P(`new.hint`)}),(0,K.jsxs)(N,{size:`md`,onClick:d,busy:c.isPending&&!c.variables,disabled:!a.trim(),children:[P(`new.build`),` `,(0,K.jsx)(v,{className:`size-4`})]})]})]}),(0,K.jsx)(`div`,{className:`mt-4 flex flex-wrap justify-center gap-2`,children:tt[A].map(e=>(0,K.jsx)(`button`,{type:`button`,onClick:()=>o(e),className:`rounded-full bg-paper-2 px-3.5 py-1.5 text-[13px] text-ink-2 transition hover:bg-paper-3 hover:text-ink`,children:e},e))})]}),(0,K.jsxs)(`section`,{className:`mx-auto max-w-5xl`,children:[(0,K.jsx)(`h2`,{className:`mt-16 mb-5 text-center font-medium text-[13px] text-ink-3 uppercase tracking-[0.08em]`,children:P(`new.orStarter`)}),(0,K.jsx)(et,{open:s.get(`starter`),busy:c.isPending&&!!c.variables,onUse:e=>n&&!c.isPending&&c.mutate(e.id)}),c.error?(0,K.jsx)(`p`,{className:`mt-3 text-center text-[14px] text-rose`,children:c.error.message}):null]}),(0,K.jsx)(`div`,{className:`mt-8 flex justify-center`,children:(0,K.jsx)(xe,{variant:`ghost`,label:P(`new.import`)})})]})}export{nt as NewWizardPage};
|
|
@@ -1,2 +1,2 @@
|
|
|
1
|
-
import{a as e,n as t,t as n}from"./jsx-runtime-D3jfb0Ew.js";import{D as r,O as i,d as a,i as o,j as s,n as c,nt as l}from"./api-u3nydnnp.js";import{t as u}from"./createLucideIcon-q3MZMmnf.js";import{n as d}from"./HomePage-
|
|
1
|
+
import{a as e,n as t,t as n}from"./jsx-runtime-D3jfb0Ew.js";import{D as r,O as i,d as a,i as o,j as s,n as c,nt as l}from"./api-u3nydnnp.js";import{t as u}from"./createLucideIcon-q3MZMmnf.js";import{n as d}from"./HomePage-BGQMVqEr.js";import{C as f,T as p,b as m,r as h,w as g,x as _}from"./outputs-Ba-Tblsj.js";import{t as v}from"./check-CUpby_J9.js";import{r as ee,t as te}from"./ChatPanel-n7GEZxTX.js";import{t as ne}from"./upload-DNRENWzQ.js";import{t as y}from"./plus-Du-Jx8aI.js";import{t as b}from"./external-link-MAL7vJYj.js";import{n as x,t as re}from"./wand-sparkles-Clj3VRB5.js";import{n as ie}from"./mic-Bvz4mA2j.js";import{a as S,c as C,d as w,f as T,i as E,l as D,m as ae,o as O,p as k,s as oe,u as A}from"./Account-BJPPu___.js";import{n as se,t as j}from"./trash-0IafyhZB.js";import{t as ce}from"./refresh-cw-Cmk7VCe0.js";import{n as le,t as ue}from"./type-BqbppSsp.js";import{_ as de,a as fe,c as M,d as N,f as P,h as F,i as I,m as L,o as R,p as pe,r as z,s as B,t as V,u as me,y as H}from"./ui-gGAdXx-P.js";import{I as U,S as he,_ as ge,g as _e,m as ve,x as ye}from"./index-Z0fbfnW7.js";import{n as be,t as xe}from"./ReadOnly-B0-ReU_0.js";var Se={name:`calendar`,size:24,node:[[`path`,{d:`M8 2v3`,key:`1ioesn`}],[`path`,{d:`M16 2v3`,key:`otl347`}],[`rect`,{x:`3`,y:`3`,width:`18`,height:`18`,rx:`2`,key:`h1oib`}],[`path`,{d:`M3 9h18`,key:`1pudct`}]]};Se.node;var Ce=u(Se),we={name:`file-spreadsheet`,size:24,node:[[`path`,{d:`M6 22a2 2 0 0 1-2-2V4a2 2 0 0 1 2-2h8a2.4 2.4 0 0 1 1.704.706l3.588 3.588A2.4 2.4 0 0 1 20 8v12a2 2 0 0 1-2 2z`,key:`1oefj6`}],[`path`,{d:`M14 2v5a1 1 0 0 0 1 1h5`,key:`wfsgrz`}],[`path`,{d:`M8 13h2`,key:`yr2amv`}],[`path`,{d:`M14 13h2`,key:`un5t4a`}],[`path`,{d:`M8 17h2`,key:`2yhykz`}],[`path`,{d:`M14 17h2`,key:`10kma7`}]]};we.node;var Te=u(we),Ee={name:`hash`,size:24,node:[[`line`,{x1:`4`,x2:`20`,y1:`9`,y2:`9`,key:`4lhtct`}],[`line`,{x1:`4`,x2:`20`,y1:`15`,y2:`15`,key:`vyu0kd`}],[`line`,{x1:`10`,x2:`8`,y1:`3`,y2:`21`,key:`1ggp8o`}],[`line`,{x1:`16`,x2:`14`,y1:`3`,y2:`21`,key:`weycgp`}]]};Ee.node;var De=u(Ee),W={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`}]]};W.node;var Oe=u(W),ke={name:`phone`,size:24,node:[[`path`,{d:`M13.832 16.568a1 1 0 0 0 1.213-.303l.355-.465A2 2 0 0 1 17 15h3a2 2 0 0 1 2 2v3a2 2 0 0 1-2 2A18 18 0 0 1 2 4a2 2 0 0 1 2-2h3a2 2 0 0 1 2 2v3a2 2 0 0 1-.8 1.6l-.468.351a1 1 0 0 0-.292 1.233 14 14 0 0 0 6.392 6.384`,key:`9njp5v`}]]};ke.node;var Ae=u(ke),je={name:`text-align-start`,size:24,node:[[`path`,{d:`M21 5H3`,key:`1fi0y6`}],[`path`,{d:`M15 12H3`,key:`6jk70r`}],[`path`,{d:`M17 19H3`,key:`z6ezky`}]],aliases:[`text`,`align-left`]};je.node;var Me=u(je),Ne={name:`toggle-left`,size:24,node:[[`circle`,{cx:`9`,cy:`12`,r:`3`,key:`u3jwor`}],[`rect`,{width:`20`,height:`14`,x:`2`,y:`5`,rx:`7`,key:`g7kal2`}]]};Ne.node;var Pe=u(Ne),G=e(t(),1),K=e(n(),1);function Fe(e){return e.type.startsWith(`image/`)&&/logo/i.test(e.name)?`logo`:/^(image|video|audio)\//.test(e.type)?`asset`:`document`}function Ie(e,t){let n=l(),[r,i]=(0,G.useState)([]),[a,s]=(0,G.useState)(`idle`),[u,d]=(0,G.useState)(null),[f,p]=(0,G.useState)(null),[m,h]=(0,G.useState)(null),g=(0,G.useRef)(null),_=()=>(g.current??=(async()=>{await Promise.all([n.invalidateQueries({queryKey:[`projects`]}),n.invalidateQueries({queryKey:[`project-files`,e]})]),t(),g.current=null})(),g.current);return{messages:r,phase:a,activity:f,startedAt:m,error:u,send:async(t,l=[])=>{if(!(t.trim()||l.length)||a!==`idle`)return!1;if(d(null),s(`thinking`),h(Date.now()),l.length){try{for(let t of l)await c.upload(`/api/studio/projects/${e}/files?kind=${Fe(t)}`,t)}catch(e){return d(e.message),s(`idle`),h(null),await _(),!1}await _();let n=`${H(`editor.attached`)}: ${l.map(e=>e.name).join(`, `)}`;t=t.trim()?`${t}\n\n${n}`:n}let u=r.map(({role:e,content:t})=>({role:e,content:t})).slice(-12),f=`p-${Date.now()}`;i(e=>[...e,{id:`u-${Date.now()}`,role:`user`,content:t,previews:ee(l)},{id:f,role:`assistant`,content:``,pending:!0}]),p(null);let m=!1;try{await o(`/api/studio/projects/${e}/assist`,{message:t,history:u},(e,t)=>{if(e===`text`){let e=JSON.parse(t);i(t=>t.map(t=>t.id===f?{...t,content:t.content+e}:t))}else if(e===`activity`)p(JSON.parse(t));else if(e===`card`){let e=JSON.parse(t);i(t=>t.map(t=>t.id===f?{...t,cards:[...t.cards??[],{...e,id:`${f}-${t.cards?.length??0}`}]}:t))}else if(e===`changed`)s(`building`),_();else if(e===`done`){m=!0;let e=JSON.parse(t);i(t=>t.map(t=>t.id===f?{...t,content:e.reply,changed:e.changed,pending:!1}:t))}else e===`error`&&(m=!0,d(JSON.parse(t).message))}),m||d(H(`editor.chatBroken`))}catch(e){d(e.message)}finally{p(null),h(null),i(e=>e.filter(e=>!(e.id===f&&!e.content&&!e.cards?.length)).map(e=>({...e,pending:!1}))),s(`idle`),await g.current,await _(),await n.invalidateQueries({queryKey:[`me`]})}return!0}}}function Le({card:e,send:t}){let n=_e().cards.find(t=>t.plugin===e.plugin&&t.tool===e.tool);return n?(0,K.jsx)(ve,{of:n,children:(0,K.jsx)(n.component,{data:e.data,send:e=>void t(e)})}):null}function Re(){return(0,K.jsxs)(`div`,{className:`sm:pr-36`,children:[(0,K.jsx)(`h2`,{className:`font-display font-semibold text-[20px] leading-tight tracking-tight`,children:H(`project.assistantTitle`)}),(0,K.jsx)(`p`,{className:`mt-1.5 max-w-2xl text-[15px] text-ink-2 leading-relaxed`,children:H(`project.assistantHello`)})]})}var ze=72,Be=720;function Ve({projectId:e,onChanged:t}){let n=Ie(e,t),r=(0,G.useRef)(null),[i,o]=(0,G.useState)(null);return(0,G.useEffect)(()=>{let e=()=>{let e=r.current?.getBoundingClientRect();e&&o(t=>{if(e.bottom>=ze)return null;let n=Math.min(e.width,Be),r=e.left+(e.width-n)/2;return t&&t.left===r&&t.width===n?t:{left:r,width:n,height:t?.height??e.height}})};return e(),window.addEventListener(`scroll`,e,{passive:!0}),window.addEventListener(`resize`,e),()=>{window.removeEventListener(`scroll`,e),window.removeEventListener(`resize`,e)}},[]),(0,K.jsxs)(`div`,{ref:r,style:i?{minHeight:i.height}:void 0,children:[(0,K.jsxs)(`div`,{className:`mb-2 flex items-center gap-1.5 px-1 font-medium text-[12px] text-ember-strong uppercase tracking-[0.07em]`,children:[(0,K.jsx)(m,{className:`size-3.5`}),` `,H(`project.assistant`)]}),(0,K.jsxs)(`div`,{className:`relative`,children:[!i&&n.messages.length===0?(0,K.jsx)(`div`,{className:`absolute -top-14 right-10 z-10 max-sm:hidden`,children:(0,K.jsx)(a,{kind:`round`,size:104})}):null,(0,K.jsx)(`div`,{className:F(`flex flex-col overflow-hidden bg-card`,i?`fixed bottom-4 z-30 max-h-[70dvh] animate-dock rounded-2xl shadow-overlay ring-1 ring-border`:`max-h-[520px] rounded-xl bg-linear-to-br from-ember-tint via-card to-card shadow-soft ring-1 ring-ember-veil`),style:i?{left:i.left,width:i.width}:void 0,children:(0,K.jsx)(te,{chat:n,avatar:`round`,compact:!!i,intro:(0,K.jsx)(Re,{}),placeholder:H(`project.assistantComposer`),changedLabel:H(`project.assistantChanged`),card:e=>(0,K.jsx)(Le,{card:e,send:n.send})})})]})]})}var He=[`text`,`longtext`,`number`,`date`,`url`,`email`,`phone`,`boolean`],Ue=/^(\d{4}-\d{2}-\d{2}|\d{1,2}\.\s?\d{1,2}\.\s?\d{4})$/,We=/^[+-]?\d{1,3}([.,\s']?\d{3})*([.,]\d+)?$/,Ge=/^[^\s@]+@[^\s@]+\.[^\s@]{2,}$/,Ke=/^(https?:\/\/|www\.)\S+$/i,qe=/^\+?[\d\s()/.-]{7,20}$/,Je=/^(ja|nein|yes|no|true|false)$/i;function Ye(e){let t=e.trim();return t?t.includes(`
|
|
2
2
|
`)||t.length>140?`longtext`:Je.test(t)?`boolean`:Ge.test(t)?`email`:Ke.test(t)?`url`:Ue.test(t)?`date`:We.test(t)&&!/^(\+|0\d)/.test(t)?`number`:qe.test(t)&&t.replace(/\D/g,``).length>=7?`phone`:`text`:`text`}function Xe(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 Ze=[{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`}],q={facts:100,colors:12,files:{logo:8,asset:100,document:50},bytes:{logo:5e6,asset:15e6,video:8e7,document:3e7}},J=/^#[0-9a-fA-F]{6}$/;function Qe({onAdd:e,onClose:t}){let[n,r]=(0,G.useState)(`#e0531b`),[i,a]=(0,G.useState)(``),o=J.test(n);return(0,K.jsx)(I,{open:!0,onClose:t,title:H(`project.colorAddTitle`),children:(0,K.jsxs)(`form`,{onSubmit:r=>{r.preventDefault(),o&&(e({name:i.trim(),value:n.toLowerCase()}),t())},className:`flex flex-col gap-5`,children:[(0,K.jsxs)(`div`,{children:[(0,K.jsx)(M,{children:H(`project.colorValue`)}),(0,K.jsxs)(`div`,{className:`flex items-center gap-2`,children:[(0,K.jsx)(P,{value:o?n:`#888888`,onChange:e=>r(e.target.value)}),(0,K.jsx)(B,{value:n,placeholder:`#e0531b`,spellCheck:!1,onChange:e=>r(e.target.value.trim()),className:`font-mono text-[14px]`})]})]}),(0,K.jsxs)(`div`,{children:[(0,K.jsx)(M,{children:H(`project.colorUseLabel`)}),(0,K.jsx)(B,{autoFocus:!0,value:i,maxLength:120,placeholder:H(`project.colorName`),onChange:e=>a(e.target.value)}),(0,K.jsx)(`p`,{className:`mt-1.5 text-[13px] text-ink-3`,children:H(`project.colorUse`)})]}),(0,K.jsxs)(`div`,{className:`flex justify-end gap-2`,children:[(0,K.jsx)(V,{variant:`ghost`,onClick:t,children:H(`common.cancel`)}),(0,K.jsx)(V,{type:`submit`,disabled:!o,children:H(`project.add`)})]})]})})}function $e({colors:e,save:t,readOnly:n}){let r=(0,G.useRef)(0),[i,a]=(0,G.useState)(()=>e.map(e=>({...e,id:`c${r.current++}`}))),[o,s]=(0,G.useState)(!1),c=w(i.filter(e=>J.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,K.jsxs)(C,{title:H(`project.colors`),hint:H(`project.colorsHint`),save:c,locked:n,children:[(0,K.jsx)(`div`,{className:`flex flex-col gap-2`,children:i.map((e,t)=>(0,K.jsxs)(`div`,{className:`flex items-center gap-2`,children:[(0,K.jsx)(P,{value:J.test(e.value)?e.value:`#888888`,onChange:t=>l(e.id,{value:t.target.value})}),(0,K.jsx)(B,{value:e.name,placeholder:H(`project.colorName`),maxLength:120,onChange:t=>l(e.id,{name:t.target.value}),className:`min-w-0 flex-1`}),(0,K.jsx)(B,{value:e.value,placeholder:`#e0531b`,spellCheck:!1,onChange:t=>l(e.id,{value:t.target.value.trim()}),className:`w-28 font-mono text-[13px]`}),(0,K.jsxs)(`div`,{className:`flex w-24 shrink-0 items-center justify-end max-sm:w-auto`,children:[t===0?(0,K.jsx)(`span`,{className:`mr-1 max-sm:hidden`,children:(0,K.jsx)(z,{tone:`ember`,children:H(`project.colorAccent`)})}):n?null:(0,K.jsx)(R,{label:H(`project.colorFirst`),onClick:()=>a(t=>[e,...t.filter(t=>t.id!==e.id)]),children:(0,K.jsx)(p,{className:`size-4`})}),n?null:(0,K.jsx)(R,{label:H(`project.remove`),onClick:()=>a(t=>t.filter(t=>t.id!==e.id)),className:`hover:text-rose`,children:(0,K.jsx)(j,{className:`size-4`})})]})]},e.id))}),i.length&&!n?(0,K.jsx)(`p`,{className:`mt-1.5 text-[13px] text-ink-3`,children:H(`project.colorUse`)}):null,i.length<q.colors&&!n?(0,K.jsxs)(V,{variant:`secondary`,size:`sm`,className:i.length?`mt-3`:void 0,onClick:()=>s(!0),children:[(0,K.jsx)(y,{className:`size-4`}),` `,H(`project.colorAdd`)]}):null,o?(0,K.jsx)(Qe,{onClose:()=>s(!1),onAdd:e=>a(t=>[...t,{...e,id:`c${r.current++}`}])}):null]})}var et={backgroundImage:`repeating-conic-gradient(#c9c9c9 0% 25%, #dedede 0% 50%)`,backgroundSize:`16px 16px`};function Y({file:e,actions:t}){let[n,r]=(0,G.useState)(e.description),i=(0,G.useRef)(e.description),a=(0,G.useRef)(null);(0,G.useEffect)(()=>{e.description!==i.current&&(r(t=>t===i.current?e.description:t),i.current=e.description)},[e.description]),(0,G.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,K.jsx)(`p`,{className:`text-[13px] text-ink-2 leading-snug`,children:n}):null:(0,K.jsx)(`textarea`,{ref:a,rows:1,value:n,maxLength:600,placeholder:H(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-[13px] 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 X(e,t){confirm(H(`project.removeConfirm`,{name:e.name}))&&t.remove(e.id)}function Z({projectId:e,file:t,small:n}){let r=A(e,t.id);return t.mime.startsWith(`image/`)?(0,K.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,K.jsx)(`video`,{src:`${r}#t=0.1`,preload:`metadata`,controls:!n,className:`size-full object-cover`}):(0,K.jsx)(`div`,{className:`flex size-full items-center justify-center text-ink-3`,children:t.mime.startsWith(`audio/`)?(0,K.jsx)(Oe,{className:n?`size-5`:`size-7`}):(0,K.jsx)(g,{className:n?`size-5`:`size-7`})})}function tt({projectId:e,kind:t,files:n,actions:r,accept:i,addLabel:a,onPreview:o}){return(0,K.jsxs)(`div`,{className:`grid grid-cols-[repeat(auto-fill,minmax(184px,1fr))] gap-3`,children:[n.map((i,a)=>(0,K.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`&&a===0?(0,K.jsx)(`span`,{className:`absolute -top-3 left-3 z-10 rounded-full ring-2 ring-card`,children:(0,K.jsx)(z,{tone:`ember`,children:H(`project.logoMain`)})}):null,(0,K.jsxs)(`div`,{className:`relative h-28 overflow-hidden rounded-md bg-paper-2`,style:t===`logo`?et:void 0,children:[o&&i.mime.startsWith(`image/`)?(0,K.jsx)(`button`,{type:`button`,"aria-label":`${H(`project.preview`)}: ${i.name}`,onClick:()=>o(i),className:`block size-full cursor-zoom-in`,children:(0,K.jsx)(Z,{projectId:e,file:i})}):(0,K.jsx)(Z,{projectId:e,file:i}),(0,K.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:[o?(0,K.jsx)(R,{label:H(`project.preview`),onClick:()=>o(i),className:`size-8 bg-card shadow-soft`,children:(0,K.jsx)(x,{className:`size-4`})}):null,t===`logo`&&a>0&&!r.readOnly?(0,K.jsx)(R,{label:H(`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,K.jsx)(le,{className:`size-4`})}):null,r.readOnly?null:(0,K.jsx)(R,{label:H(`project.remove`),onClick:()=>X(i,r),className:`size-8 bg-card shadow-soft hover:text-rose`,children:(0,K.jsx)(j,{className:`size-4`})})]})]}),t===`asset`?(0,K.jsx)(`div`,{className:`truncate px-0.5 text-[12px] text-ink-3`,title:i.name,children:i.name}):null,(0,K.jsx)(Y,{file:i,actions:r})]},i.id)),a&&!r.readOnly?(0,K.jsxs)(S,{accept:i,multiple:!1,onFiles:e=>r.upload(t,e),className:`min-h-28 flex-col p-3`,children:[r.busy?(0,K.jsx)(N,{className:`size-5`}):(0,K.jsx)(y,{className:`size-5`}),a]}):null]})}function nt({projectId:e,data:t,readOnly:n}){let r=T(e,n);return(0,K.jsxs)(C,{title:H(`project.logos`),hint:H(`project.logosHint`),children:[(0,K.jsx)(tt,{projectId:e,kind:`logo`,files:t.files.filter(e=>e.kind===`logo`),actions:r,accept:`image/*`,addLabel:H(`project.logoAdd`)}),r.error?(0,K.jsx)(`p`,{className:`mt-3 text-[14px] text-rose`,children:r.error}):null]})}var rt=e=>[(e.name.includes(`.`)?e.name.split(`.`).pop():e.mime.split(`/`).pop())?.toUpperCase().slice(0,5),D(e.size)].filter(Boolean).join(` · `);function it({projectId:e,file:t,actions:n,onClose:r}){let i=A(e,t.id);return(0,K.jsxs)(I,{open:!0,onClose:r,wide:`page`,title:t.name,children:[(0,K.jsxs)(`div`,{className:`-mt-2 mb-4 flex items-center justify-between gap-3`,children:[(0,K.jsx)(`span`,{className:`text-[13px] text-ink-3`,children:rt(t)}),(0,K.jsx)(`a`,{href:i,target:`_blank`,rel:`noreferrer`,"aria-label":H(`project.openOriginal`),title:H(`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,K.jsx)(b,{className:`size-4`})})]}),t.mime.startsWith(`image/`)?(0,K.jsx)(`div`,{className:`overflow-hidden rounded-lg`,style:et,children:(0,K.jsx)(`img`,{src:i,alt:``,className:`mx-auto max-h-[68dvh] object-contain`})}):t.mime.startsWith(`video/`)?(0,K.jsx)(`video`,{src:i,controls:!0,className:`max-h-[68dvh] w-full rounded-lg bg-black`}):(0,K.jsx)(`audio`,{src:i,controls:!0,className:`w-full`}),(0,K.jsx)(`div`,{className:`mt-4`,children:(0,K.jsx)(Y,{file:t,actions:n})})]})}function at({projectId:e,file:t,actions:n,onPreview:r}){return(0,K.jsxs)(`li`,{className:`flex items-start gap-3 rounded-lg bg-paper p-2 ring-1 ring-border-soft`,children:[(0,K.jsx)(`button`,{type:`button`,"aria-label":`${H(`project.preview`)}: ${t.name}`,onClick:r,className:`size-14 shrink-0 cursor-zoom-in overflow-hidden rounded-md bg-paper-2`,children:(0,K.jsx)(Z,{projectId:e,file:t,small:!0})}),(0,K.jsxs)(`div`,{className:`flex min-w-0 flex-1 flex-col gap-1 py-0.5`,children:[(0,K.jsxs)(`div`,{className:`flex flex-wrap items-baseline gap-x-3`,children:[(0,K.jsx)(`button`,{type:`button`,onClick:r,title:t.name,className:`min-w-0 truncate font-medium text-[14px] hover:underline`,children:t.name}),(0,K.jsx)(`span`,{className:`text-[12px] text-ink-3`,children:rt(t)})]}),(0,K.jsx)(Y,{file:t,actions:n})]}),(0,K.jsxs)(`div`,{className:`flex shrink-0 items-start`,children:[(0,K.jsx)(R,{label:H(`project.preview`),onClick:r,children:(0,K.jsx)(x,{className:`size-4`})}),n.readOnly?null:(0,K.jsx)(R,{label:H(`project.remove`),onClick:()=>X(t,n),className:`hover:text-rose`,children:(0,K.jsx)(j,{className:`size-4`})})]})]})}function ot({projectId:e,data:t,readOnly:n}){let r=T(e,n),[i,a]=k(`assets`,`cards`),[o,s]=(0,G.useState)(``),[c,l]=(0,G.useState)(null),u=t.files.filter(e=>e.kind===`asset`),d=u.find(e=>e.id===c),f=o.trim().toLowerCase(),p=f?u.filter(e=>`${e.name} ${e.description}`.toLowerCase().includes(f)):u;return(0,K.jsxs)(C,{title:H(`project.assets`),hint:H(`project.assetsHint`),children:[u.length?(0,K.jsx)(O,{layout:i,onToggle:a,children:(0,K.jsx)(oe,{value:o,onChange:s,placeholder:H(`project.assetSearch`)})}):null,p.length?(0,K.jsx)(`div`,{className:`mb-3`,children:i===`cards`?(0,K.jsx)(tt,{projectId:e,kind:`asset`,files:p,actions:r,onPreview:e=>l(e.id)}):(0,K.jsx)(`ul`,{className:`flex flex-col gap-2`,children:p.map(t=>(0,K.jsx)(at,{projectId:e,file:t,actions:r,onPreview:()=>l(t.id)},t.id))})}):null,n?u.length?null:(0,K.jsx)(`p`,{className:`text-[14px] text-ink-3`,children:H(`project.staysLocal`)}):(0,K.jsxs)(S,{accept:`image/*,video/*,audio/*`,onFiles:e=>r.upload(`asset`,e),className:`h-16 w-full`,children:[r.busy?(0,K.jsx)(N,{className:`size-4`}):(0,K.jsx)(ne,{className:`size-4`}),H(`project.drop`),` `,(0,K.jsx)(`span`,{className:`underline`,children:H(`project.assetAdd`)})]}),r.error?(0,K.jsx)(`p`,{className:`mt-3 text-[14px] text-rose`,children:r.error}):null,d?(0,K.jsx)(it,{projectId:e,file:d,actions:r,onClose:()=>l(null)}):null]})}function st(e,t,n){return s({queryKey:[`project-file-text`,t.id,t.chars,n],queryFn:()=>c.get(`/api/studio/projects/${e}/files/${t.id}/text?limit=${n}`),enabled:t.status===`ready`,staleTime:6e4})}function ct(e){return((e.name.includes(`.`)?e.name.split(`.`).pop():``)||e.mime.split(`/`).pop()||``).toUpperCase().slice(0,5)}var Q=e=>[ct(e),e.pages?H(`project.pages`,{n:e.pages}):null,D(e.size)].filter(Boolean).join(` · `);function $({file:e}){return e.status===`pending`?(0,K.jsxs)(`span`,{className:`inline-flex items-center gap-1.5 text-[12px] text-ink-3`,children:[(0,K.jsx)(N,{className:`size-3`}),` `,H(`project.reading`)]}):e.status===`failed`?(0,K.jsx)(`span`,{className:`text-[12px] text-rose`,children:e.error}):e.indexed?(0,K.jsx)(z,{tone:`live`,children:e.indexed===`embeddings`?H(`project.indexed`):H(`project.indexedKeywords`)}):(0,K.jsx)(z,{tone:`warn`,children:H(`project.notIndexed`)})}function lt({file:e,actions:t,onPreview:n}){return(0,K.jsxs)(K.Fragment,{children:[(0,K.jsx)(R,{label:H(`project.preview`),onClick:n,children:(0,K.jsx)(x,{className:`size-4`})}),e.status!==`pending`&&!t.readOnly?(0,K.jsx)(R,{label:H(`project.reindex`),onClick:()=>t.reindex(e.id),children:(0,K.jsx)(ce,{className:`size-4`})}):null,t.readOnly?null:(0,K.jsx)(R,{label:H(`project.remove`),onClick:()=>X(e,t),className:`hover:text-rose`,children:(0,K.jsx)(j,{className:`size-4`})})]})}function ut({file:e,actions:t,onPreview:n}){let r=/sheet|csv|excel/.test(e.mime);return(0,K.jsxs)(`li`,{className:`flex gap-3 rounded-lg bg-paper p-3 ring-1 ring-border-soft`,children:[(0,K.jsx)(`div`,{className:`mt-0.5 text-ink-3`,children:r?(0,K.jsx)(Te,{className:`size-5`}):(0,K.jsx)(ie,{className:`size-5`})}),(0,K.jsxs)(`div`,{className:`flex min-w-0 flex-1 flex-col gap-1.5`,children:[(0,K.jsxs)(`div`,{className:`flex flex-wrap items-center gap-x-3 gap-y-1`,children:[(0,K.jsx)(`button`,{type:`button`,onClick:n,title:e.name,className:`min-w-0 truncate font-medium text-[14px] hover:underline`,children:e.name}),(0,K.jsx)(`span`,{className:`text-[12px] text-ink-3`,children:Q(e)}),(0,K.jsx)($,{file:e})]}),(0,K.jsx)(Y,{file:e,actions:t})]}),(0,K.jsx)(`div`,{className:`-my-1 flex shrink-0 items-start`,children:(0,K.jsx)(lt,{file:e,actions:t,onPreview:n})})]})}function dt({projectId:e,file:t}){let n=st(e,t,1500);return t.mime.startsWith(`image/`)?(0,K.jsx)(`img`,{src:A(e,t.id),alt:``,className:`size-full object-cover`}):t.status===`pending`||n.isLoading?(0,K.jsx)(`div`,{className:`flex size-full items-center justify-center text-ink-4`,children:(0,K.jsx)(N,{className:`size-5`})}):(0,K.jsxs)(K.Fragment,{children:[(0,K.jsx)(`div`,{className:`w-[222%] origin-top-left scale-[0.45] p-6`,children:(0,K.jsx)(h,{text:n.data?.text??``})}),(0,K.jsx)(`div`,{className:`absolute inset-x-0 bottom-0 h-12 bg-linear-to-t from-card to-transparent`})]})}function ft({projectId:e,file:t,actions:n,onPreview:r}){return(0,K.jsxs)(`li`,{className:`group flex flex-col gap-1.5 rounded-lg bg-paper p-2 pb-2.5 ring-1 ring-border-soft`,children:[(0,K.jsxs)(`div`,{className:`relative`,children:[(0,K.jsx)(`button`,{type:`button`,onClick:r,"aria-label":`${H(`project.preview`)}: ${t.name}`,className:`relative block h-44 w-full overflow-hidden rounded-md bg-card text-left ring-1 ring-border-soft transition hover:ring-border`,children:(0,K.jsx)(dt,{projectId:e,file:t})}),(0,K.jsx)(`div`,{className:`absolute top-1 right-1 flex gap-1 opacity-0 transition focus-within:opacity-100 group-hover:opacity-100 coarse:opacity-100 [&>button]:size-8 [&>button]:bg-card [&>button]:shadow-soft`,children:(0,K.jsx)(lt,{file:t,actions:n,onPreview:r})})]}),(0,K.jsxs)(`div`,{className:`mt-1 flex flex-col gap-1 px-0.5`,children:[(0,K.jsx)(`div`,{className:`truncate font-medium text-[13px]`,title:t.name,children:t.name}),(0,K.jsxs)(`div`,{className:`flex flex-wrap items-center gap-x-2 gap-y-1`,children:[(0,K.jsx)(`span`,{className:`text-[12px] text-ink-3`,children:Q(t)}),(0,K.jsx)($,{file:t})]})]}),(0,K.jsx)(Y,{file:t,actions:n})]})}var pt=2e5;function mt({projectId:e,file:t,onClose:n}){let r=t.mime===`application/pdf`||t.mime.startsWith(`image/`),[i,a]=(0,G.useState)(r?`original`:`text`),o=st(e,t,pt),s=A(e,t.id),c=(e,t)=>(0,K.jsx)(`button`,{type:`button`,"aria-pressed":i===e,onClick:()=>a(e),className:F(`h-8 rounded-full px-3 text-[13px] transition`,i===e?`bg-paper-2 font-medium text-ink`:`text-ink-3 hover:text-ink`),children:t});return(0,K.jsxs)(I,{open:!0,onClose:n,wide:`page`,title:t.name,children:[(0,K.jsxs)(`div`,{className:`-mt-2 mb-4 flex flex-wrap items-center gap-x-3 gap-y-2`,children:[(0,K.jsx)(`span`,{className:`text-[13px] text-ink-3`,children:Q(t)}),(0,K.jsx)($,{file:t}),(0,K.jsxs)(`div`,{className:`ml-auto flex items-center gap-1`,children:[r?(0,K.jsxs)(K.Fragment,{children:[c(`original`,H(`project.original`)),c(`text`,H(`project.readText`))]}):null,(0,K.jsx)(`a`,{href:s,target:`_blank`,rel:`noreferrer`,"aria-label":H(`project.openOriginal`),title:H(`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,K.jsx)(b,{className:`size-4`})})]})]}),i===`original`?t.mime===`application/pdf`?(0,K.jsx)(`iframe`,{src:s,title:t.name,className:`h-[70dvh] w-full rounded-lg bg-paper-2 ring-1 ring-border-soft`}):(0,K.jsx)(`img`,{src:s,alt:``,className:`mx-auto max-h-[70dvh] rounded-lg object-contain`}):o.isLoading?(0,K.jsx)(`div`,{className:`flex h-40 items-center justify-center text-ink-3`,children:(0,K.jsx)(N,{})}):o.data?.text?(0,K.jsxs)(K.Fragment,{children:[(0,K.jsx)(`div`,{className:`overflow-x-auto rounded-lg bg-paper p-5 ring-1 ring-border-soft`,children:(0,K.jsx)(h,{text:o.data.text,className:`text-[14px]`})}),o.data.chars>o.data.text.length?(0,K.jsx)(`p`,{className:`mt-3 text-[13px] text-ink-3`,children:H(`project.textCut`,{shown:o.data.text.length.toLocaleString(),total:o.data.chars.toLocaleString()})}):null]}):(0,K.jsx)(`p`,{className:`py-8 text-center text-[14px] text-ink-3`,children:H(`project.noText`)})]})}function ht({projectId:e}){let[t,n]=(0,G.useState)(``),[r,i]=(0,G.useState)(null),[a,o]=(0,G.useState)(!1),s=async()=>{if(!t.trim()){i(null);return}o(!0);try{let n=await c.post(`/api/studio/projects/${e}/search`,{query:t});i(n.hits)}catch{i([])}finally{o(!1)}};return(0,K.jsxs)(K.Fragment,{children:[(0,K.jsx)(oe,{value:t,placeholder:H(`project.searchTest`),busy:a,onEnter:()=>void s(),onChange:e=>{n(e),e.trim()||i(null)}}),r?r.length?(0,K.jsx)(`ul`,{className:`mt-2 flex flex-col gap-2`,children:r.map((e,t)=>(0,K.jsxs)(`li`,{className:`rounded-lg bg-paper-2 px-3 py-2 text-[13px]`,children:[(0,K.jsx)(`div`,{className:`mb-0.5 font-medium text-[12px] text-ink-3`,children:e.name}),(0,K.jsx)(`p`,{className:`line-clamp-3 whitespace-pre-line text-ink-2`,children:e.text})]},t))}):(0,K.jsx)(`p`,{className:`mt-2 text-[13px] text-ink-3`,children:H(`project.searchNone`)}):null]})}function gt({projectId:e,data:t,readOnly:n}){let r=T(e,n),[i,a]=k(`documents`,`list`),[o,s]=(0,G.useState)(null),c=t.files.filter(e=>e.kind===`document`),l=c.find(e=>e.id===o),u=i===`cards`?ft:ut;return(0,K.jsxs)(C,{title:H(`project.documents`),hint:H(`project.documentsHint`),children:[c.length?(0,K.jsx)(O,{layout:i,onToggle:a,children:(0,K.jsx)(ht,{projectId:e})}):null,c.length?(0,K.jsx)(`ul`,{className:F(`mb-3`,i===`cards`?`grid grid-cols-[repeat(auto-fill,minmax(220px,1fr))] gap-3`:`flex flex-col gap-2`),children:c.map(t=>(0,K.jsx)(u,{projectId:e,file:t,actions:r,onPreview:()=>s(t.id)},t.id))}):null,n?c.length?null:(0,K.jsx)(`p`,{className:`text-[14px] text-ink-3`,children:H(`project.staysLocal`)}):(0,K.jsxs)(S,{accept:`.pdf,.docx,.doc,.xlsx,.csv,.tsv,.txt,.md,.json,.html,.eml,image/*`,onFiles:e=>r.upload(`document`,e),className:`h-16 w-full`,children:[r.busy?(0,K.jsx)(N,{className:`size-4`}):(0,K.jsx)(ne,{className:`size-4`}),H(`project.drop`),` `,(0,K.jsx)(`span`,{className:`underline`,children:H(`project.documentAdd`)})]}),r.error?(0,K.jsx)(`p`,{className:`mt-3 text-[14px] text-rose`,children:r.error}):null,c.length&&!t.embeddings?(0,K.jsx)(`p`,{className:`mt-3 text-[13px] text-ink-3`,children:H(`project.keywordsOnly`)}):null,l?(0,K.jsx)(mt,{projectId:e,file:l,onClose:()=>s(null)}):null]})}var _t=e=>/^(ja|yes|true)$/i.test(e.trim()),vt={text:ue,longtext:Me,number:De,date:Ce,url:se,email:f,phone:Ae,boolean:Pe};function yt({type:e,detected:t,onChange:n}){let[r,i]=(0,G.useState)(!1),[a,o]=(0,G.useState)(!1),s=(0,G.useRef)(null);(0,G.useEffect)(()=>{if(!r)return;let e=e=>{s.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 c=vt[e??t],l=`${H(`project.factType`)}: ${H(`project.type.${e??t}`)}`,u=`flex w-full items-center gap-3 rounded-lg px-3 py-2 text-left text-[14px] text-ink-2 hover:bg-accent hover:text-ink`,d=e=>{n(e),i(!1)};return(0,K.jsxs)(`div`,{className:`relative`,ref:s,children:[(0,K.jsx)(`button`,{type:`button`,"aria-label":l,title:l,"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,K.jsx)(c,{className:`size-4`})}),r?(0,K.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,K.jsxs)(`button`,{type:`button`,role:`menuitemradio`,"aria-checked":!e,className:u,onClick:()=>d(void 0),children:[(0,K.jsx)(re,{className:`size-4 shrink-0`}),(0,K.jsx)(`span`,{className:`flex-1`,children:H(`project.factAuto`)}),(0,K.jsx)(`span`,{className:`text-[12px] text-ink-4`,children:H(`project.type.${t}`)}),(0,K.jsx)(v,{className:F(`size-4 shrink-0`,e&&`invisible`)})]}),(0,K.jsx)(`div`,{className:`mx-2 my-1 h-px bg-border-soft`}),He.map(t=>{let n=vt[t];return(0,K.jsxs)(`button`,{type:`button`,role:`menuitemradio`,"aria-checked":e===t,className:u,onClick:()=>d(t),children:[(0,K.jsx)(n,{className:`size-4 shrink-0`}),(0,K.jsx)(`span`,{className:`flex-1`,children:H(`project.type.${t}`)}),(0,K.jsx)(v,{className:F(`size-4 shrink-0`,e!==t&&`invisible`)})]},t)})]}):null]})}function bt({facts:e,save:t,readOnly:n}){let r=(0,G.useRef)(0),i=(0,G.useRef)(null),[a,o]=(0,G.useState)(()=>e.map(e=>({...e,id:`f${r.current++}`}))),s=w(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=Ze.filter(e=>!a.some(t=>t.key===e.key));return(0,K.jsxs)(C,{title:H(`project.facts`),hint:H(`project.factsHint`),save:s,locked:n,action:a.length<q.facts&&!n?(0,K.jsxs)(V,{variant:`secondary`,size:`sm`,onClick:()=>l({},`label`,!0),children:[(0,K.jsx)(y,{className:`size-4`}),` `,H(`project.factAdd`)]}):null,children:[(0,K.jsx)(`div`,{className:`flex flex-col gap-2`,children:a.map(e=>{let t=Ye(e.value),r=e.type??t;return(0,K.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,K.jsx)(B,{ref:u(`${e.id}:label`),value:e.label,placeholder:H(`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:Xe(e.label,a.map(e=>e.key))})},className:`max-sm:col-span-3 max-sm:font-medium sm:mr-1`}),e.type===`boolean`?(0,K.jsxs)(`div`,{className:`flex h-11 items-center gap-3`,children:[(0,K.jsx)(pe,{checked:_t(e.value),label:e.label,onChange:t=>c(e.id,{value:H(t?`project.yes`:`project.no`)})}),(0,K.jsx)(`span`,{className:`text-[14px] text-ink-2`,children:_t(e.value)?H(`project.yes`):H(`project.no`)})]}):(0,K.jsx)(L,{ref:u(`${e.id}:value`),rows:1,minRows:r===`longtext`?2:1,maxRows:10,value:e.value,placeholder:H(`project.factValue`),onChange:t=>c(e.id,{value:t.target.value}),className:`min-h-11`}),(0,K.jsx)(yt,{type:e.type,detected:t,onChange:t=>c(e.id,{type:t})}),n?null:(0,K.jsx)(R,{label:H(`project.remove`),onClick:()=>o(t=>t.filter(t=>t.id!==e.id)),className:`size-11 rounded-lg hover:text-rose`,children:(0,K.jsx)(j,{className:`size-4`})})]},e.id)})}),a.length<q.facts&&!n?(0,K.jsxs)(`div`,{className:`flex flex-wrap items-center gap-2 ${a.length?`mt-4`:``}`,children:[(0,K.jsxs)(V,{variant:`secondary`,size:`sm`,onClick:()=>l({},`label`),children:[(0,K.jsx)(y,{className:`size-4`}),` `,H(`project.factAdd`)]}),d.map(e=>(0,K.jsxs)(`button`,{type:`button`,onClick:()=>l({key:e.key,label:de===`en`?e.en:e.de},`value`),className:`inline-flex h-8 items-center gap-1 rounded-full bg-paper-2 px-3 text-[13px] text-ink-2 transition hover:bg-paper-3 hover:text-ink`,children:[(0,K.jsx)(y,{className:`size-3.5`}),` `,de===`en`?e.en:e.de]},e.key))]}):null]})}function xt({project:e,save:t}){let[n,r]=(0,G.useState)(e.brand.name??``),[i,a]=(0,G.useState)(e.brand.about??``),o=w({name:n.trim(),about:i.trim()},e=>t({brand:e}));return(0,K.jsx)(C,{title:H(`project.base`),hint:H(`project.baseHint`),save:o,locked:e.readOnly,children:(0,K.jsxs)(`div`,{className:`flex flex-col gap-5`,children:[(0,K.jsxs)(`div`,{children:[(0,K.jsx)(M,{children:H(`project.title`)}),(0,K.jsx)(B,{value:n,maxLength:120,onChange:e=>r(e.target.value)}),(0,K.jsx)(`p`,{className:`mt-1.5 text-[13px] text-ink-3`,children:H(`project.titleHint`)})]}),(0,K.jsxs)(`div`,{children:[(0,K.jsx)(M,{children:H(`project.about`)}),(0,K.jsx)(L,{minRows:4,value:i,onChange:e=>a(e.target.value)}),(0,K.jsx)(`p`,{className:`mt-1.5 text-[13px] text-ink-3`,children:H(`project.aboutHint`)})]})]})})}function St({project:e,save:t}){let[n,r]=(0,G.useState)(!1),[i,a]=(0,G.useState)(e.name),o=U({mutationFn:()=>t({name:i.trim()}),onSuccess:()=>r(!1)});return(0,K.jsxs)(K.Fragment,{children:[(0,K.jsx)(R,{label:H(`project.rename`),onClick:()=>{a(e.name),r(!0)},children:(0,K.jsx)(_,{className:`size-4`})}),(0,K.jsx)(I,{open:n,onClose:()=>r(!1),title:H(`project.rename`),children:(0,K.jsxs)(`form`,{onSubmit:e=>{e.preventDefault(),i.trim()&&o.mutate()},children:[(0,K.jsx)(B,{autoFocus:!0,value:i,maxLength:80,onChange:e=>a(e.target.value)}),o.error?(0,K.jsx)(`p`,{className:`mt-3 text-[14px] text-rose`,children:o.error.message}):null,(0,K.jsxs)(`div`,{className:`mt-5 flex justify-end gap-2`,children:[(0,K.jsx)(V,{variant:`ghost`,onClick:()=>r(!1),children:H(`common.cancel`)}),(0,K.jsx)(V,{type:`submit`,busy:o.isPending,disabled:!i.trim(),children:H(`settings.save`)})]})]})})]})}function Ct({project:e,children:t}){let n=l(),r=ae(e.id),[i,a]=(0,G.useState)(0),o=async t=>{await c.patch(`/api/studio/projects/${e.id}`,t),await n.invalidateQueries({queryKey:[`projects`]})},s=U({mutationFn:()=>c.del(`/api/studio/projects/${e.id}`),onSuccess:()=>n.invalidateQueries({queryKey:[`projects`]})}),u=he(),f=r.data??{files:[],embeddings:!0},p=`${e.id}:${i}`,m=e.readOnly;return(0,K.jsxs)(`div`,{className:`flex flex-col gap-9 pb-20`,children:[u?(0,K.jsxs)(`div`,{className:`-mb-3 flex items-center gap-1`,children:[(0,K.jsx)(d,{}),m?null:(0,K.jsx)(St,{project:e,save:o})]}):null,m?(0,K.jsx)(xe,{children:be(e)}):(0,K.jsx)(Ve,{projectId:e.id,onChanged:()=>a(e=>e+1)},e.id),(0,K.jsx)(E,{id:`base`,children:(0,K.jsx)(xt,{project:e,save:o},`base:${p}`)}),(0,K.jsx)(E,{id:`logos`,children:(0,K.jsx)(nt,{projectId:e.id,data:f,readOnly:m})}),(0,K.jsx)(E,{id:`colors`,children:(0,K.jsx)($e,{colors:e.brand.colors??[],save:e=>o({brand:{colors:e}}),readOnly:m},`colors:${p}`)}),(0,K.jsx)(E,{id:`assets`,children:(0,K.jsx)(ot,{projectId:e.id,data:f,readOnly:m})}),(0,K.jsx)(E,{id:`documents`,children:(0,K.jsx)(gt,{projectId:e.id,data:f,readOnly:m})}),(0,K.jsx)(E,{id:`facts`,children:(0,K.jsx)(bt,{facts:e.facts,save:e=>o({facts:e}),readOnly:m},`facts:${p}`)}),t,u&&!m?(0,K.jsxs)(`div`,{children:[(0,K.jsx)(V,{variant:`danger`,busy:s.isPending,onClick:()=>confirm(`${H(`settings.delete`)}?`)&&s.mutate(),children:H(`settings.delete`)}),s.error?(0,K.jsx)(`p`,{className:`mt-2 text-[14px] text-rose`,children:s.error.message}):null]}):null]})}function wt(e){let t=e.join(` `),[n,r]=(0,G.useState)(e[0]);return(0,G.useEffect)(()=>{let e=t.split(` `),n=0,i=()=>{n=0;let t=window.scrollY>0&&window.innerHeight+window.scrollY>=document.documentElement.scrollHeight-4,i=Math.max(160,window.innerHeight/3),a=e[0];for(let t of e){let e=document.getElementById(t)?.getBoundingClientRect().top;e!==void 0&&e<=i&&(a=t)}r(t?e.at(-1):a)},a=()=>{n||=requestAnimationFrame(i)};return i(),window.addEventListener(`scroll`,a,{passive:!0}),window.addEventListener(`resize`,a),()=>{cancelAnimationFrame(n),window.removeEventListener(`scroll`,a),window.removeEventListener(`resize`,a)}},[t]),n}function Tt(e,t){let n=window.matchMedia(`(prefers-reduced-motion: reduce)`).matches;document.getElementById(e)?.scrollIntoView({block:`start`,behavior:t&&!n?`smooth`:`auto`})}function Et(){let{project:e,loading:t}=ye(),n=i(),{hash:a}=r(),o=_e(),s=ge(o),c=s.flatMap(e=>e.sections),l=wt(c.map(e=>e.id)),u=e=>{Tt(e,!0),n({hash:e},{replace:!0})},d=e?.id,f=(0,G.useRef)(!1);(0,G.useEffect)(()=>{let e=a.slice(1);!f.current&&d&&e&&document.getElementById(e)&&(f.current=!0,requestAnimationFrame(()=>Tt(e,!1)))},[d,o.spaceSections]);let p=s.slice(1).flatMap(e=>e.sections).map(e=>o.spaceSections.find(t=>t.id===e.id)).filter(e=>e!==void 0);return(0,K.jsxs)(`div`,{className:`animate-rise`,children:[(0,K.jsx)(`h1`,{className:`font-display font-semibold text-[28px] tracking-tight`,children:H(`nav.project`)}),(0,K.jsxs)(`div`,{className:`mt-6 grid gap-6 md:mt-8 md:grid-cols-[200px_minmax(0,1fr)] md:gap-10`,children:[(0,K.jsx)(`nav`,{className:`max-md:hidden`,children:(0,K.jsx)(`ul`,{className:`sticky top-24 flex flex-col gap-0.5`,children:s.map(e=>(0,K.jsxs)(G.Fragment,{children:[e.label?(0,K.jsx)(`li`,{className:`truncate px-3 pt-4 pb-1 font-medium text-[11px] text-ink-4 uppercase tracking-[0.07em]`,children:e.label}):null,e.sections.map(e=>(0,K.jsx)(`li`,{children:(0,K.jsx)(`a`,{href:`#${e.id}`,onClick:t=>{t.preventDefault(),u(e.id)},"aria-current":e.id===l?`location`:void 0,className:F(`block rounded-lg px-3 py-2 text-[14px] transition`,e.id===l?`bg-paper-2 font-medium text-ink`:`text-ink-3 hover:bg-accent hover:text-ink`),children:e.label})},e.id))]},e.plugin??``))})}),(0,K.jsx)(`div`,{className:`-mx-4 sticky top-16 z-30 bg-background/85 px-4 py-2 backdrop-blur-md md:hidden`,children:(0,K.jsx)(me,{value:l??``,onChange:u,options:c.map(e=>({value:e.id,label:e.label}))})}),(0,K.jsxs)(`div`,{className:`min-w-0`,children:[e?(0,K.jsx)(Ct,{project:e,children:p.map(e=>(0,K.jsx)(E,{id:e.id,children:(0,K.jsx)(C,{title:e.label(),hint:e.hint?.(),plain:!0,children:(0,K.jsx)(ve,{of:e,children:(0,K.jsx)(e.component,{})})})},e.serial))},e.id):null,e||t?null:(0,K.jsx)(fe,{children:H(`settings.noProject`)})]})]})]})}export{Et as ProjectPage};
|
|
@@ -1 +1 @@
|
|
|
1
|
-
import{a as e,n as t,t as n}from"./jsx-runtime-D3jfb0Ew.js";import{O as r,a as i,c as a,d as o,f as s,h as c,j as l,k as u,l as d,n as f,r as p}from"./api-u3nydnnp.js";import{t as m}from"./createLucideIcon-q3MZMmnf.js";import{t as h}from"./RunnerView-
|
|
1
|
+
import{a as e,n as t,t as n}from"./jsx-runtime-D3jfb0Ew.js";import{O as r,a as i,c as a,d as o,f as s,h as c,j as l,k as u,l as d,n as f,r as p}from"./api-u3nydnnp.js";import{t as m}from"./createLucideIcon-q3MZMmnf.js";import{t as h}from"./RunnerView-njFeqF1A.js";import{t as g}from"./arrow-right-6FyN3e7D.js";import{_,m as v,v as y}from"./outputs-Ba-Tblsj.js";import{d as b,h as x,t as S,y as C}from"./ui-gGAdXx-P.js";var w={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`}]]};w.node;var T=m(w),E={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`}]]};E.node;var D=m(E),O={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`]};O.node;var k=m(O),A=e(t(),1);function j(){if(window.self===window.top)return null;let e=new URLSearchParams(window.location.search).get(`embed`);return e===`inline`||e===`modal`?e:null}var M=j(),N=(e,t={})=>window.parent.postMessage({type:`engenty-wizard:${e}`,...t},`*`);function P(){(0,A.useEffect)(()=>{if(M===`inline`){let e=document.documentElement;document.getElementById(`root`)?.style.setProperty(`min-height`,`0`),e.style.overflow=`hidden`;let t=new ResizeObserver(()=>N(`height`,{height:Math.ceil(e.getBoundingClientRect().height)}));return t.observe(e),()=>t.disconnect()}if(M===`modal`){let e=e=>{e.key===`Escape`&&!document.querySelector(`dialog[open]`)&&N(`close`)};return window.addEventListener(`keydown`,e),()=>window.removeEventListener(`keydown`,e)}},[])}var F=e(n(),1);function I(e){(0,A.useEffect)(()=>{if(!e)return;let t=document.documentElement;return t.style.setProperty(`--raw-primary`,e),()=>{t.style.removeProperty(`--raw-primary`)}},[e])}function L(e,t){(0,A.useEffect)(()=>{if(!e||!t)return;let n=a(`/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 R=/iPhone|iPad|iPod/.test(navigator.userAgent)||navigator.platform===`MacIntel`&&navigator.maxTouchPoints>1,z=R||/Android/.test(navigator.userAgent);function B(){let[e,t]=(0,A.useState)(()=>window.wizardInstall??null),[n,r]=(0,A.useState)(!1);if((0,A.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||z&&!e&&!R)return null;let i=/Mac/.test(navigator.platform),a=C(z?`install.ios`:i?`install.bookmark.mac`:`install.bookmark.pc`);return(0,F.jsxs)(`div`,{className:`mt-6 flex flex-col items-center gap-2 text-[13px] text-ink-3`,children:[(0,F.jsxs)(`button`,{type:`button`,onClick:()=>{z&&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:[z?(0,F.jsx)(k,{className:`size-4`}):(0,F.jsx)(T,{className:`size-4`}),C(z?`install.add`:`install.bookmark`)]}),n?(0,F.jsx)(`p`,{className:`max-w-xs leading-relaxed`,children:a}):null]})}function V({brand:e,toggle:t=!0}){return(0,F.jsx)(`header`,{className:`safe-top`,children:(0,F.jsxs)(`div`,{className:`relative flex h-14 items-center justify-center px-5`,children:[e.logoUrl?(0,F.jsx)(`img`,{src:a(e.logoUrl),alt:e.name,className:`h-7 max-w-[160px] object-contain`}):e.name?(0,F.jsx)(`span`,{className:`max-w-[60%] truncate font-display font-semibold text-[15px] text-ink-2 tracking-tight`,children:e.name}):null,t?(0,F.jsx)(`div`,{className:`absolute right-3`,children:(0,F.jsx)(s,{})}):null]})})}function H({siteKey:e,onToken:t}){let n=(0,A.useRef)(null);return(0,A.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,F.jsx)(`div`,{ref:n,className:`mt-4 flex justify-center`})}function U({token:e}){return!/iPhone|iPad|iPod|Android/.test(navigator.userAgent)||v||M?null:(0,F.jsxs)(`a`,{href:_(`${window.location.origin}${i}/w/${e}`),className:`mt-3 inline-flex items-center gap-1.5 text-[13px] text-ink-3 underline-offset-4 hover:text-ink hover:underline coarse:min-h-11`,children:[(0,F.jsx)(D,{className:`size-4`}),` `,C(`install.app`)]})}var W=e=>`wz.run.${e}`,G=v&&new URLSearchParams(window.location.search).get(`start`)===`1`,K=M===`inline`?`min-h-80`:`min-h-dvh`;function q({wizard:e}){let t=r(),[n,i]=(0,A.useState)(!1),[a,s]=(0,A.useState)(null),[c,l]=(0,A.useState)(null),u=(()=>{try{return localStorage.getItem(W(e.token))}catch{return null}})(),d=async()=>{i(!0),s(null);try{let{runId:n}=await f.post(`/api/public/wizards/${e.token}/runs`,{turnstileToken:c??void 0,embedded:M!==null});try{localStorage.setItem(W(e.token),n)}catch{}t(`/w/${e.token}/${n}`,{replace:G})}catch(e){s(e.message),i(!1)}},p=G&&e.available&&!e.turnstileSiteKey,m=(0,A.useRef)(!1);return(0,A.useEffect)(()=>{p&&!m.current&&(m.current=!0,d())},[p]),p&&!a?(0,F.jsx)(`div`,{className:`flex min-h-[60dvh] items-center justify-center text-ink-4`,children:(0,F.jsx)(b,{})}):(0,F.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,F.jsx)(o,{kind:e.avatar,size:190,fluffy:!0}),(0,F.jsx)(`h1`,{className:`mt-2 text-balance font-display font-semibold text-[30px] leading-[1.1] tracking-tight sm:text-[34px]`,children:e.title}),e.description?(0,F.jsx)(`p`,{className:`mt-3 text-[16px] text-ink-2 leading-relaxed`,children:e.description}):null,e.available?(0,F.jsxs)(F.Fragment,{children:[(0,F.jsxs)(S,{size:`lg`,className:`mt-10 min-w-48`,busy:n,disabled:!!e.turnstileSiteKey&&!c,onClick:d,children:[C(`run.start`),` `,(0,F.jsx)(g,{className:`size-4`})]}),e.turnstileSiteKey?(0,F.jsx)(H,{siteKey:e.turnstileSiteKey,onToken:l}):null,u?(0,F.jsx)(`button`,{type:`button`,onClick:()=>t(`/w/${e.token}/${u}`),className:`mt-4 text-[14px] text-ink-3 underline-offset-4 hover:text-ink hover:underline coarse:min-h-11`,children:C(`run.resume`)}):null,M||v?null:(0,F.jsx)(B,{}),(0,F.jsx)(U,{token:e.token})]}):(0,F.jsx)(`p`,{className:`mt-10 rounded-xl bg-paper-2 px-5 py-4 text-[15px] text-ink-2`,children:e.unavailableReason??C(`run.unavailable`)}),a?(0,F.jsx)(`p`,{className:`mt-4 text-[14px] text-rose`,children:a}):null]})}function J(){let{token:e,runId:t}=u(),n=r(),a=l({queryKey:[`public`,e],queryFn:()=>f.get(`/api/public/wizards/${e}`),retry:(e,t)=>p(t)&&e<3});if(I(a.data?.brand.accent),c(a.data?.avatar),L(e,a.data?.title),P(),(0,A.useEffect)(()=>{a.data&&(document.title=a.data.title)},[a.data]),(0,A.useEffect)(()=>{e&&t&&y(`run`,{token:e,runId:t})},[e,t]),a.isLoading)return(0,F.jsx)(`div`,{className:x(`flex items-center justify-center text-ink-4`,K),children:(0,F.jsx)(b,{})});if(!a.data){let e=p(a.error);return(0,F.jsxs)(`div`,{className:x(`flex flex-col items-center justify-center gap-4 px-6 text-center`,K),children:[(0,F.jsx)(o,{kind:`pebble`,size:80}),(0,F.jsx)(`p`,{className:`max-w-xs text-ink-3`,children:C(e?`common.offline`:`run.notFound`)}),e?(0,F.jsx)(S,{variant:`secondary`,onClick:()=>void a.refetch(),children:C(`common.retry`)}):null]})}return(0,F.jsxs)(`div`,{className:x(`flex flex-col`,K),children:[M===`inline`||v?null:(0,F.jsx)(V,{brand:a.data.brand,toggle:!M}),(0,F.jsx)(`div`,{className:`flex-1`,children:t?(0,F.jsx)(h,{runId:t,onRestart:()=>n(`/w/${e}`)}):(0,F.jsx)(q,{wizard:a.data})}),v?(0,F.jsx)(`div`,{className:`safe-bottom`}):(0,F.jsx)(`footer`,{className:`safe-bottom pt-6 text-center text-[12px] text-ink-4`,children:(0,F.jsx)(`a`,{href:`${i}/`,target:M?`_blank`:void 0,rel:`noreferrer`,className:`inline-block py-3.5 hover:text-ink-2`,children:C(`run.madeWith`).replace(`engenty wizards`,d.name)})})]})}export{V as BrandHeader,J as PublicRunner,I as useBrandAccent};
|