import{s as yl,o as ol,n as Ul}from"../chunks/scheduler.e4ff9b64.js";import{S as ml,i as rl,e as I,s as M,c as w,h as Il,a as C,d as a,b as T,f as wl,g as j,j as V,k as jl,l as Cl,m as e,n as y,t as o,o as m,p as r}from"../chunks/index.09f1bca0.js";import{C as ul,H as hl,E as dl}from"../chunks/MermaidChart.svelte_svelte_type_style_lang.dde31fc2.js";import{C as _}from"../chunks/CodeBlock.54e44b16.js";import{H as Vl,a as Jl}from"../chunks/HfOption.44827c7f.js";function Bl(u){let J,n;return J=new _({props:{code:"aW1wb3J0JTIwdG9yY2glMEFmcm9tJTIwZGlmZnVzZXJzLm1vZHVsYXJfcGlwZWxpbmVzJTIwaW1wb3J0JTIwTW9kdWxhclBpcGVsaW5lQmxvY2tzJTJDJTIwSW5wdXRQYXJhbSUyQyUyME91dHB1dFBhcmFtJTBBJTBBY2xhc3MlMjBUZXh0VG9JbWFnZUJsb2NrKE1vZHVsYXJQaXBlbGluZUJsb2NrcyklM0ElMEElMjAlMjAlMjAlMjBtb2RlbF9uYW1lJTIwJTNEJTIwJTIydGV4dDJpbWclMjIlMEElMEElMjAlMjAlMjAlMjAlNDBwcm9wZXJ0eSUwQSUyMCUyMCUyMCUyMGRlZiUyMGlucHV0cyhzZWxmKSUzQSUwQSUyMCUyMCUyMCUyMCUyMCUyMCUyMCUyMHJldHVybiUyMCU1QklucHV0UGFyYW0obmFtZSUzRCUyMnByb21wdCUyMiklNUQlMEElMEElMjAlMjAlMjAlMjAlNDBwcm9wZXJ0eSUwQSUyMCUyMCUyMCUyMGRlZiUyMGludGVybWVkaWF0ZV9vdXRwdXRzKHNlbGYpJTNBJTBBJTIwJTIwJTIwJTIwJTIwJTIwJTIwJTIwcmV0dXJuJTIwJTVCJTVEJTBBJTBBJTIwJTIwJTIwJTIwJTQwcHJvcGVydHklMEElMjAlMjAlMjAlMjBkZWYlMjBkZXNjcmlwdGlvbihzZWxmKSUzQSUwQSUyMCUyMCUyMCUyMCUyMCUyMCUyMC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F0ZSklMEElMjAlMjAlMjAlMjAlMjAlMjAlMjAlMjByZXR1cm4lMjBjb21wb25lbnRzJTJDJTIwc3RhdGU=",highlighted:`<span class="hljs-keyword">import</span> torch
<span class="hljs-keyword">from</span> diffusers.modular_pipelines <span class="hljs-keyword">import</span> ModularPipelineBlocks, InputParam, OutputParam

<span class="hljs-keyword">class</span> <span class="hljs-title class_">TextToImageBlock</span>(<span class="hljs-title class_ inherited__">ModularPipelineBlocks</span>):
    model_name = <span class="hljs-string">&quot;text2img&quot;</span>

<span class="hljs-meta">    @property</span>
    <span class="hljs-keyword">def</span> <span class="hljs-title function_">inputs</span>(<span class="hljs-params">self</span>):
        <span class="hljs-keyword">return</span> [InputParam(name=<span class="hljs-string">&quot;prompt&quot;</span>)]

<span class="hljs-meta">    @property</span>
    <span class="hljs-keyword">def</span> <span class="hljs-title function_">intermediate_outputs</span>(<span class="hljs-params">self</span>):
        <span class="hljs-keyword">return</span> []

<span class="hljs-meta">    @property</span>
    <span class="hljs-keyword">def</span> <span class="hljs-title function_">description</span>(<span class="hljs-params">self</span>):
        <span class="hljs-keyword">return</span> <span class="hljs-string">&quot;我是一个文本到图像的工作流程！&quot;</span>

    <span class="hljs-keyword">def</span> <span class="hljs-title function_">__call__</span>(<span class="hljs-params">self, components, state</span>):
        block_state = self.get_block_state(state)
        <span class="hljs-built_in">print</span>(<span class="hljs-string">&quot;运行文本到图像工作流程&quot;</span>)
        <span class="hljs-comment"># 在这里添加你的文本到图像逻辑</span>
        <span class="hljs-comment"># 例如：根据提示生成图像</span>
        self.set_block_state(state, block_state)
        <span class="hljs-keyword">return</span> components, state`,wrap:!1}}),{c(){w(J.$$.fragment)},l(s){j(J.$$.fragment,s)},m(s,c){y(J,s,c),n=!0},p:Ul,i(s){n||(o(J.$$.fragment,s),n=!0)},o(s){m(J.$$.fragment,s),n=!1},d(s){r(J,s)}}}function fl(u){let J,n;return J=new _({props:{code:"Y2xhc3MlMjBJbWFnZVRvSW1hZ2VCbG9jay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MjIlRTglQkYlOTAlRTglQTElOEMlRTUlOUIlQkUlRTUlODMlOEYlRTUlODglQjAlRTUlOUIlQkUlRTUlODMlOEYlRTUlQjclQTUlRTQlQkQlOUMlRTYlQjUlODElRTclQTglOEIlMjIpJTBBJTIwJTIwJTIwJTIwJTIwJTIwJTIwJTIwJTIzJTIwJUU1JTlDJUE4JUU4JUJGJTk5JUU5JTg3JThDJUU2JUI3JUJCJUU1JThBJUEwJUU0JUJEJUEwJUU3JTlBJTg0JUU1JTlCJUJFJUU1JTgzJThGJUU1JTg4JUIwJUU1JTlCJUJFJUU1JTgzJThGJUU5JTgwJUJCJUU4JUJFJTkxJTBBJTIwJTIwJTIwJTIwJTIwJTIwJTIwJTIwJTIzJTIwJUU0JUJFJThCJUU1JUE2JTgyJUVGJUJDJTlBJUU2JUEwJUI5JUU2JThEJUFFJUU2JThGJTkwJUU3JUE0JUJBJUU4JUJEJUFDJUU2JThEJUEyJUU4JUJFJTkzJUU1JTg1JUE1JUU1JTlCJUJFJUU1JTgzJThGJTBBJTIwJTIwJTIwJTIwJTIwJTIwJTIwJTIwc2VsZi5zZXRfYmxvY2tfc3RhdGUoc3RhdGUlMkMlMjBibG9ja19zdGF0ZSklMEElMjAlMjAlMjAlMjAlMjAlMjAlMjAlMjByZXR1cm4lMjBjb21wb25lbnRzJTJDJTIwc3RhdGU=",highlighted:`<span class="hljs-keyword">class</span> <span class="hljs-title class_">ImageToImageBlock</span>(<span class="hljs-title class_ inherited__">ModularPipelineBlocks</span>):
    model_name = <span class="hljs-string">&quot;img2img&quot;</span>

<span class="hljs-meta">    @property</span>
    <span class="hljs-keyword">def</span> <span class="hljs-title function_">inputs</span>(<span class="hljs-params">self</span>):
        <span class="hljs-keyword">return</span> [InputParam(name=<span class="hljs-string">&quot;prompt&quot;</span>), InputParam(name=<span class="hljs-string">&quot;image&quot;</span>)]

<span class="hljs-meta">    @property</span>
    <span class="hljs-keyword">def</span> <span class="hljs-title function_">intermediate_outputs</span>(<span class="hljs-params">self</span>):
        <span class="hljs-keyword">return</span> []

<span class="hljs-meta">    @property</span>
    <span class="hljs-keyword">def</span> <span class="hljs-title function_">description</span>(<span class="hljs-params">self</span>):
        <span class="hljs-keyword">return</span> <span class="hljs-string">&quot;我是一个图像到图像的工作流程！&quot;</span>

    <span class="hljs-keyword">def</span> <span class="hljs-title function_">__call__</span>(<span class="hljs-params">self, components, state</span>):
        block_state = self.get_block_state(state)
        <span class="hljs-built_in">print</span>(<span class="hljs-string">&quot;运行图像到图像工作流程&quot;</span>)
        <span class="hljs-comment"># 在这里添加你的图像到图像逻辑</span>
        <span class="hljs-comment"># 例如：根据提示转换输入图像</span>
        self.set_block_state(state, block_state)
        <span class="hljs-keyword">return</span> components, state`,wrap:!1}}),{c(){w(J.$$.fragment)},l(s){j(J.$$.fragment,s)},m(s,c){y(J,s,c),n=!0},p:Ul,i(s){n||(o(J.$$.fragment,s),n=!0)},o(s){m(J.$$.fragment,s),n=!1},d(s){r(J,s)}}}function kl(u){let J,n;return J=new _({props:{code:"Y2xhc3MlMjBJbnBhaW50QmxvY2soTW9kdWxhclBpcGVsaW5lQmxvY2tzKSUzQSUwQSUyMCUyMCUyMCUyMG1vZGVsX25hbWUlMjAlM0QlMjAlMjJpbnBhaW50JTIyJTBBJTBBJTIwJTIwJTIwJTIwJTQwcHJvcGVydHklMEElMjAlMjAlMjAlMjBkZWYlMjBpbnB1dHMoc2VsZiklM0ElMEElMjAlMjAlMjAlMjAlMjAlMjAlMjAlMjByZXR1cm4lMjAlNUJJbnB1dFBhcmFtKG5hbWUlM0QlMjJwcm9tcHQlMjIpJTJDJTIwSW5wdXRQYXJhbShuYW1lJTNEJTIyaW1hZ2UlMjIpJTJDJTIwSW5wdXRQYXJhbShuYW1lJTNEJTIybWFzayUyMiklNUQlMEElMEElMjAlMjAlMjAlMjAlNDBwcm9wZXJ0eSUwQSUwQSUyMCUyMCUyMCUyMGRlZiUyMGludGVybWVkaWF0ZV9vdXRwdXRzKHNlbGYpJT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lGJTBBJTIwJTIwJTIwJTIwJTIwJTIwJTIwJTIwc2VsZi5zZXRfYmxvY2tfc3RhdGUoc3RhdGUlMkMlMjBibG9ja19zdGF0ZSklMEElMjAlMjAlMjAlMjAlMjAlMjAlMjAlMjByZXR1cm4lMjBjb21wb25lbnRzJTJDJTIwc3RhdGU=",highlighted:`<span class="hljs-keyword">class</span> <span class="hljs-title class_">InpaintBlock</span>(<span class="hljs-title class_ inherited__">ModularPipelineBlocks</span>):
    model_name = <span class="hljs-string">&quot;inpaint&quot;</span>

<span class="hljs-meta">    @property</span>
    <span class="hljs-keyword">def</span> <span class="hljs-title function_">inputs</span>(<span class="hljs-params">self</span>):
        <span class="hljs-keyword">return</span> [InputParam(name=<span class="hljs-string">&quot;prompt&quot;</span>), InputParam(name=<span class="hljs-string">&quot;image&quot;</span>), InputParam(name=<span class="hljs-string">&quot;mask&quot;</span>)]

<span class="hljs-meta">    @property</span>

    <span class="hljs-keyword">def</span> <span class="hljs-title function_">intermediate_outputs</span>(<span class="hljs-params">self</span>):
        <span class="hljs-keyword">return</span> []

<span class="hljs-meta">    @property</span>
    <span class="hljs-keyword">def</span> <span class="hljs-title function_">description</span>(<span class="hljs-params">self</span>):
        <span class="hljs-keyword">return</span> <span class="hljs-string">&quot;我是一个修复工作流！&quot;</span>

    <span class="hljs-keyword">def</span> <span class="hljs-title function_">__call__</span>(<span class="hljs-params">self, components, state</span>):
        block_state = self.get_block_state(state)
        <span class="hljs-built_in">print</span>(<span class="hljs-string">&quot;运行修复工作流&quot;</span>)
        <span class="hljs-comment"># 在这里添加你的修复逻辑</span>
        <span class="hljs-comment"># 例如：根据提示填充被遮罩的区域</span>
        self.set_block_state(state, block_state)
        <span class="hljs-keyword">return</span> components, state`,wrap:!1}}),{c(){w(J.$$.fragment)},l(s){j(J.$$.fragment,s)},m(s,c){y(J,s,c),n=!0},p:Ul,i(s){n||(o(J.$$.fragment,s),n=!0)},o(s){m(J.$$.fragment,s),n=!1},d(s){r(J,s)}}}function Ql(u){let J,n,s,c,i,d;return J=new Jl({props:{id:"auto",option:"text-to-image",$$slots:{default:[Bl]},$$scope:{ctx:u}}}),s=new Jl({props:{id:"auto",option:"image-to-image",$$slots:{default:[fl]},$$scope:{ctx:u}}}),i=new Jl({props:{id:"auto",option:"inpaint",$$slots:{default:[kl]},$$scope:{ctx:u}}}),{c(){w(J.$$.fragment),n=M(),w(s.$$.fragment),c=M(),w(i.$$.fragment)},l(t){j(J.$$.fragment,t),n=T(t),j(s.$$.fragment,t),c=T(t),j(i.$$.fragment,t)},m(t,p){y(J,t,p),e(t,n,p),y(s,t,p),e(t,c,p),y(i,t,p),d=!0},p(t,p){const h={};p&2&&(h.$$scope={dirty:p,ctx:t}),J.$set(h);const Z={};p&2&&(Z.$$scope={dirty:p,ctx:t}),s.$set(Z);const f={};p&2&&(f.$$scope={dirty:p,ctx:t}),i.$set(f)},i(t){d||(o(J.$$.fragment,t),o(s.$$.fragment,t),o(i.$$.fragment,t),d=!0)},o(t){m(J.$$.fragment,t),m(s.$$.fragment,t),m(i.$$.fragment,t),d=!1},d(t){t&&(a(n),a(c)),r(J,t),r(s,t),r(i,t)}}}function bl(u){let J,n,s,c,i,d,t,p,h,Z="<code>AutoPipelineBlocks</code> 是一种包含支持不同工作流程的块的多块类型。它根据运行时提供的输入自动选择要运行的子块。这通常用于将多个工作流程（文本到图像、图像到图像、修复）打包到一个管道中以便利。",f,k,tl="本指南展示如何创建 <code>AutoPipelineBlocks</code>。",O,Q,al="创建三个 <code>ModularPipelineBlocks</code> 用于文本到图像、图像到图像和修复。这些代表了管道中可用的不同工作流程。",W,B,z,b,el="创建一个包含子块类及其对应块名称列表的<code>AutoPipelineBlocks</code>类。",x,g,nl="你还需要包括<code>block_trigger_inputs</code>，一个触发相应块的输入名称列表。如果在运行时提供了触发输入，则选择该块运行。使用<code>None</code>来指定如果未检测到触发输入时运行的默认块。",H,E,Ml="最后，重要的是包括一个<code>description</code>，清楚地解释哪些输入触发哪些工作流。这有助于用户理解如何运行特定的工作流。",v,R,X,A,Tl="包含<code>description</code>以避免任何关于如何运行块和需要什么输入的混淆<strong>非常</strong>重要。虽然<code>AutoPipelineBlocks</code>很方便，但如果它没有正确解释，其条件逻辑可能难以理解。",D,F,pl="创建<code>AutoImageBlocks</code>的一个实例。",q,N,P,S,il="对于更复杂的组合，例如在更大的管道中作为子块使用的嵌套<code>AutoPipelineBlocks</code>块，使用<code>get_execution_blocks()</code>方法根据你的输入提取实际运行的块。",L,G,K,$,ll,Y,sl;return i=new ul({props:{containerStyle:"float: right; margin-left: 10px; display: inline-flex; position: relative; z-index: 10;"}}),t=new hl({props:{title:"AutoPipelineBlocks",local:"autopipelineblocks",headingTag:"h1"}}),B=new Vl({props:{id:"auto",options:["text-to-image","image-to-image","inpaint"],$$slots:{default:[Ql]},$$scope:{ctx:u}}}),R=new _({props:{code:"ZnJvbSUyMGRpZmZ1c2Vycy5tb2R1bGFyX3BpcGVsaW5lcyUyMGltcG9ydCUyMEF1dG9QaXBlbGluZUJsb2NrcyUwQSUwQWNsYXNzJTIwQXV0b0ltYWdlQmxvY2tzKEF1dG9QaXBlbGluZUJsb2NrcyklM0ElMEElMjAlMjAlMjAlMjAlMjMlMjAlRTklODAlODklRTYlOEIlQTklRTUlQUQlOTAlRTUlOUQlOTclRTclQjElQkIlRTclOUElODQlRTUlODglOTclRTglQTElQTglMEElMjAlMjAlMjAlMjBibG9ja19jbGFzc2VzJTIwJTNEJTIwJTVCYmxvY2tfaW5wYWludF9jbHMlMkMlMjBibG9ja19pMmlfY2xzJTJDJTIwYmxvY2tfdDJpX2NscyU1RCUwQSUyMCUyMCUyMCUyMCUyMyUyMCVFNiVBRiU4RiVFNCVCOCVBQSVFNSU5RCU5NyVFNyU5QSU4NCVFNSU5MCU4RCVFNyVBNyVCMCVFRiVCQyU4QyVFOSVBMSVCQSVFNSVCQSU4RiVFNyU5QiVCOCVFNSU5MCU4QyUwQSUyMCUyMCUyMCUyMGJsb2NrX25hbWVzJTIwJ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JTIwJTIwJTIwJTIwJTIwJTJCJTIwJTIyJTIwLSUyMHRleHQyaW1nJTIwd29ya2Zsb3clMjBpcyUyMHJ1biUyMHdoZW4lMjBuZWl0aGVyJTIwJTYwaW1hZ2UlNjAlMjBub3IlMjAlNjBtYXNrJTYwJTIwaXMlMjBwcm92aWRlZC4lNUNuJTIyJTBBJTIwJTIwJTIwJTIwJTIwJTIwJTIwJTIwKQ==",highlighted:`<span class="hljs-keyword">from</span> diffusers.modular_pipelines <span class="hljs-keyword">import</span> AutoPipelineBlocks

<span class="hljs-keyword">class</span> <span class="hljs-title class_">AutoImageBlocks</span>(<span class="hljs-title class_ inherited__">AutoPipelineBlocks</span>):
    <span class="hljs-comment"># 选择子块类的列表</span>
    block_classes = [block_inpaint_cls, block_i2i_cls, block_t2i_cls]
    <span class="hljs-comment"># 每个块的名称，顺序相同</span>
    block_names = [<span class="hljs-string">&quot;inpaint&quot;</span>, <span class="hljs-string">&quot;img2img&quot;</span>, <span class="hljs-string">&quot;text2img&quot;</span>]
    <span class="hljs-comment"># 决定运行哪个块的触发输入</span>
    <span class="hljs-comment"># - &quot;mask&quot; 触发修复工作流</span>
    <span class="hljs-comment"># - &quot;image&quot; 触发img2img工作流（但仅在未提供mask时）</span>
    <span class="hljs-comment"># - 如果以上都没有，运行text2img工作流（默认）</span>
    block_trigger_inputs = [<span class="hljs-string">&quot;mask&quot;</span>, <span class="hljs-string">&quot;image&quot;</span>, <span class="hljs-literal">None</span>]
    <span class="hljs-comment"># 对于AutoPipelineBlocks来说，描述极其重要</span>

    <span class="hljs-keyword">def</span> <span class="hljs-title function_">description</span>(<span class="hljs-params">self</span>):
        <span class="hljs-keyword">return</span> (
            <span class="hljs-string">&quot;Pipeline generates images given different types of conditions!\\n&quot;</span>
            + <span class="hljs-string">&quot;This is an auto pipeline block that works for text2img, img2img and inpainting tasks.\\n&quot;</span>
            + <span class="hljs-string">&quot; - inpaint workflow is run when \`mask\` is provided.\\n&quot;</span>
            + <span class="hljs-string">&quot; - img2img workflow is run when \`image\` is provided (but only when \`mask\` is not provided).\\n&quot;</span>
            + <span class="hljs-string">&quot; - text2img workflow is run when neither \`image\` nor \`mask\` is provided.\\n&quot;</span>
        )`,wrap:!1}}),N=new _({props:{code:"YXV0b19ibG9ja3MlMjAlM0QlMjBBdXRvSW1hZ2VCbG9ja3MoKQ==",highlighted:"auto_blocks = AutoImageBlocks()",wrap:!1}}),G=new _({props:{code:"YXV0b19ibG9ja3MuZ2V0X2V4ZWN1dGlvbl9ibG9ja3MoJTIybWFzayUyMik=",highlighted:'auto_blocks.get_execution_blocks(<span class="hljs-string">&quot;mask&quot;</span>)',wrap:!1}}),$=new dl({props:{source:"https://github.com/huggingface/diffusers/blob/main/docs/source/zh/modular_diffusers/auto_pipeline_blocks.md"}}),{c(){J=I("meta"),n=M(),s=I("p"),c=M(),w(i.$$.fragment),d=M(),w(t.$$.fragment),p=M(),h=I("p"),h.innerHTML=Z,f=M(),k=I("p"),k.innerHTML=tl,O=M(),Q=I("p"),Q.innerHTML=al,W=M(),w(B.$$.fragment),z=M(),b=I("p"),b.innerHTML=el,x=M(),g=I("p"),g.innerHTML=nl,H=M(),E=I("p"),E.innerHTML=Ml,v=M(),w(R.$$.fragment),X=M(),A=I("p"),A.innerHTML=Tl,D=M(),F=I("p"),F.innerHTML=pl,q=M(),w(N.$$.fragment),P=M(),S=I("p"),S.innerHTML=il,L=M(),w(G.$$.fragment),K=M(),w($.$$.fragment),ll=M(),Y=I("p"),this.h()},l(l){const U=Il("svelte-u9bgzb",document.head);J=C(U,"META",{name:!0,content:!0}),U.forEach(a),n=T(l),s=C(l,"P",{}),wl(s).forEach(a),c=T(l),j(i.$$.fragment,l),d=T(l),j(t.$$.fragment,l),p=T(l),h=C(l,"P",{"data-svelte-h":!0}),V(h)!=="svelte-t8sy4p"&&(h.innerHTML=Z),f=T(l),k=C(l,"P",{"data-svelte-h":!0}),V(k)!=="svelte-1dx0tz3"&&(k.innerHTML=tl),O=T(l),Q=C(l,"P",{"data-svelte-h":!0}),V(Q)!=="svelte-1u6c0ae"&&(Q.innerHTML=al),W=T(l),j(B.$$.fragment,l),z=T(l),b=C(l,"P",{"data-svelte-h":!0}),V(b)!=="svelte-15zzyvs"&&(b.innerHTML=el),x=T(l),g=C(l,"P",{"data-svelte-h":!0}),V(g)!=="svelte-t2lfhl"&&(g.innerHTML=nl),H=T(l),E=C(l,"P",{"data-svelte-h":!0}),V(E)!=="svelte-1h835av"&&(E.innerHTML=Ml),v=T(l),j(R.$$.fragment,l),X=T(l),A=C(l,"P",{"data-svelte-h":!0}),V(A)!=="svelte-e0psh3"&&(A.innerHTML=Tl),D=T(l),F=C(l,"P",{"data-svelte-h":!0}),V(F)!=="svelte-1hrujnn"&&(F.innerHTML=pl),q=T(l),j(N.$$.fragment,l),P=T(l),S=C(l,"P",{"data-svelte-h":!0}),V(S)!=="svelte-1ul4yal"&&(S.innerHTML=il),L=T(l),j(G.$$.fragment,l),K=T(l),j($.$$.fragment,l),ll=T(l),Y=C(l,"P",{}),wl(Y).forEach(a),this.h()},h(){jl(J,"name","hf:doc:metadata"),jl(J,"content",gl)},m(l,U){Cl(document.head,J),e(l,n,U),e(l,s,U),e(l,c,U),y(i,l,U),e(l,d,U),y(t,l,U),e(l,p,U),e(l,h,U),e(l,f,U),e(l,k,U),e(l,O,U),e(l,Q,U),e(l,W,U),y(B,l,U),e(l,z,U),e(l,b,U),e(l,x,U),e(l,g,U),e(l,H,U),e(l,E,U),e(l,v,U),y(R,l,U),e(l,X,U),e(l,A,U),e(l,D,U),e(l,F,U),e(l,q,U),y(N,l,U),e(l,P,U),e(l,S,U),e(l,L,U),y(G,l,U),e(l,K,U),y($,l,U),e(l,ll,U),e(l,Y,U),sl=!0},p(l,[U]){const cl={};U&2&&(cl.$$scope={dirty:U,ctx:l}),B.$set(cl)},i(l){sl||(o(i.$$.fragment,l),o(t.$$.fragment,l),o(B.$$.fragment,l),o(R.$$.fragment,l),o(N.$$.fragment,l),o(G.$$.fragment,l),o($.$$.fragment,l),sl=!0)},o(l){m(i.$$.fragment,l),m(t.$$.fragment,l),m(B.$$.fragment,l),m(R.$$.fragment,l),m(N.$$.fragment,l),m(G.$$.fragment,l),m($.$$.fragment,l),sl=!1},d(l){l&&(a(n),a(s),a(c),a(d),a(p),a(h),a(f),a(k),a(O),a(Q),a(W),a(z),a(b),a(x),a(g),a(H),a(E),a(v),a(X),a(A),a(D),a(F),a(q),a(P),a(S),a(L),a(K),a(ll),a(Y)),a(J),r(i,l),r(t,l),r(B,l),r(R,l),r(N,l),r(G,l),r($,l)}}}const gl='{"title":"AutoPipelineBlocks","local":"autopipelineblocks","sections":[],"depth":1}';function El(u){return ol(()=>{new URLSearchParams(window.location.search).get("fw")}),[]}class Gl extends ml{constructor(J){super(),rl(this,J,El,bl,yl,{})}}export{Gl as component};
