diff --git a/Makefile b/Makefile index 0e679b9c7..315adf8a4 100644 --- a/Makefile +++ b/Makefile @@ -698,13 +698,14 @@ else @echo 'Now rebuilding vulkan shaders for Linux...' @chmod +x vulkan-shaders-gen glslc-linux @echo 'Checking if bundled glslc-linux binary is usable...' - @GLSLC_BIN=$$(if ./glslc-linux --version >/dev/null 2>&1; then \ - echo "./glslc-linux"; \ - elif command -v glslc >/dev/null 2>&1; then \ - echo "glslc"; \ - else \ - echo ""; \ - fi); \ + @GLSLC_BIN=$$( \ + if [ -x ./glslc-linux ] && ./glslc-linux --version 2>/dev/null | grep -q "glslang"; then \ + echo "./glslc-linux"; \ + elif command -v glslc >/dev/null 2>&1; then \ + echo "glslc"; \ + else \ + echo ""; \ + fi); \ if [ -z "$$GLSLC_BIN" ]; then \ echo "Error: No usable glslc found. Vulkan shaders cannot be compiled!"; \ else \ diff --git a/kcpp_sdui.embd b/kcpp_sdui.embd index e86736306..1b2d2e5e1 100644 --- a/kcpp_sdui.embd +++ b/kcpp_sdui.embd @@ -506,7 +506,7 @@ gl_FragColor.rgb *= color.a; `?(s++,f[s]=0):f[s]++;f[0]>0&&(this.insertCharStyleObject(c.lineIndex,c.charIndex,f[0],h),h=h&&h.slice(f[0]+1)),s&&this.insertNewlineStyleObject(c.lineIndex,c.charIndex+f[0],s);for(var d=1;d0?this.insertCharStyleObject(c.lineIndex+d,0,f[d],h):h&&this.styles[c.lineIndex+d]&&h[0]&&(this.styles[c.lineIndex+d][0]=h[0]),h=h&&h.slice(f[d]+1);f[d]>0&&this.insertCharStyleObject(c.lineIndex+d,0,f[d],h)},setSelectionStartEndWithShift:function(o,u,h){h<=o?(u===o?this._selectionDirection="left":this._selectionDirection==="right"&&(this._selectionDirection="left",this.selectionEnd=o),this.selectionStart=h):h>o&&ho?this.selectionStart=o:this.selectionStart<0&&(this.selectionStart=0),this.selectionEnd>o?this.selectionEnd=o:this.selectionEnd<0&&(this.selectionEnd=0)}})}(),t.util.object.extend(t.IText.prototype,{initDoubleClickSimulation:function(){this.__lastClickTime=+new Date,this.__lastLastClickTime=+new Date,this.__lastPointer={},this.on("mousedown",this.onMouseDown)},onMouseDown:function(a){if(!!this.canvas){this.__newClickTime=+new Date;var o=a.pointer;this.isTripleClick(o)&&(this.fire("tripleclick",a),this._stopEvent(a.e)),this.__lastLastClickTime=this.__lastClickTime,this.__lastClickTime=this.__newClickTime,this.__lastPointer=o,this.__lastIsEditing=this.isEditing,this.__lastSelected=this.selected}},isTripleClick:function(a){return this.__newClickTime-this.__lastClickTime<500&&this.__lastClickTime-this.__lastLastClickTime<500&&this.__lastPointer.x===a.x&&this.__lastPointer.y===a.y},_stopEvent:function(a){a.preventDefault&&a.preventDefault(),a.stopPropagation&&a.stopPropagation()},initCursorSelectionHandlers:function(){this.initMousedownHandler(),this.initMouseupHandler(),this.initClicks()},doubleClickHandler:function(a){!this.isEditing||this.selectWord(this.getSelectionStartFromPointer(a.e))},tripleClickHandler:function(a){!this.isEditing||this.selectLine(this.getSelectionStartFromPointer(a.e))},initClicks:function(){this.on("mousedblclick",this.doubleClickHandler),this.on("tripleclick",this.tripleClickHandler)},_mouseDownHandler:function(a){!this.canvas||!this.editable||a.e.button&&a.e.button!==1||(this.__isMousedown=!0,this.selected&&(this.inCompositionMode=!1,this.setCursorByClick(a.e)),this.isEditing&&(this.__selectionStartOnMouseDown=this.selectionStart,this.selectionStart===this.selectionEnd&&this.abortCursorAnimation(),this.renderCursorOrSelection()))},_mouseDownHandlerBefore:function(a){!this.canvas||!this.editable||a.e.button&&a.e.button!==1||(this.selected=this===this.canvas._activeObject)},initMousedownHandler:function(){this.on("mousedown",this._mouseDownHandler),this.on("mousedown:before",this._mouseDownHandlerBefore)},initMouseupHandler:function(){this.on("mouseup",this.mouseUpHandler)},mouseUpHandler:function(a){if(this.__isMousedown=!1,!(!this.editable||this.group||a.transform&&a.transform.actionPerformed||a.e.button&&a.e.button!==1)){if(this.canvas){var o=this.canvas._activeObject;if(o&&o!==this)return}this.__lastSelected&&!this.__corner?(this.selected=!1,this.__lastSelected=!1,this.enterEditing(a.e),this.selectionStart===this.selectionEnd?this.initDelayedCursor(!0):this.renderCursorOrSelection()):this.selected=!0}},setCursorByClick:function(a){var o=this.getSelectionStartFromPointer(a),u=this.selectionStart,h=this.selectionEnd;a.shiftKey?this.setSelectionStartEndWithShift(u,h,o):(this.selectionStart=o,this.selectionEnd=o),this.isEditing&&(this._fireSelectionChanged(),this._updateTextarea())},getSelectionStartFromPointer:function(a){for(var o=this.getLocalPointer(a),u=0,h=0,c=0,f=0,s=0,d,v,g=0,y=this._textLines.length;g0&&(f+=this._textLines[g-1].length+this.missingNewlineOffset(g-1));d=this._getLineLeftOffset(s),h=d*this.scaleX,v=this._textLines[s],this.direction==="rtl"&&(o.x=this.width*this.scaleX-o.x+h);for(var b=0,_=v.length;b<_&&(u=h,h+=this.__charBounds[s][b].kernedWidth*this.scaleX,h<=o.x);b++)f++;return this._getNewSelectionStartFromOffset(o,u,h,f,_)},_getNewSelectionStartFromOffset:function(a,o,u,h,c){var f=a.x-o,s=u-a.x,d=s>f||s<0?0:1,v=h+d;return this.flipX&&(v=c-v),v>this._text.length&&(v=this._text.length),v}}),t.util.object.extend(t.IText.prototype,{initHiddenTextarea:function(){this.hiddenTextarea=t.document.createElement("textarea"),this.hiddenTextarea.setAttribute("autocapitalize","off"),this.hiddenTextarea.setAttribute("autocorrect","off"),this.hiddenTextarea.setAttribute("autocomplete","off"),this.hiddenTextarea.setAttribute("spellcheck","false"),this.hiddenTextarea.setAttribute("data-fabric-hiddentextarea",""),this.hiddenTextarea.setAttribute("wrap","off");var a=this._calcTextareaPosition();this.hiddenTextarea.style.cssText="position: absolute; top: "+a.top+"; left: "+a.left+"; z-index: -999; opacity: 0; width: 1px; height: 1px; font-size: 1px; padding\uFF70top: "+a.fontSize+";",this.hiddenTextareaContainer?this.hiddenTextareaContainer.appendChild(this.hiddenTextarea):t.document.body.appendChild(this.hiddenTextarea),t.util.addListener(this.hiddenTextarea,"keydown",this.onKeyDown.bind(this)),t.util.addListener(this.hiddenTextarea,"keyup",this.onKeyUp.bind(this)),t.util.addListener(this.hiddenTextarea,"input",this.onInput.bind(this)),t.util.addListener(this.hiddenTextarea,"copy",this.copy.bind(this)),t.util.addListener(this.hiddenTextarea,"cut",this.copy.bind(this)),t.util.addListener(this.hiddenTextarea,"paste",this.paste.bind(this)),t.util.addListener(this.hiddenTextarea,"compositionstart",this.onCompositionStart.bind(this)),t.util.addListener(this.hiddenTextarea,"compositionupdate",this.onCompositionUpdate.bind(this)),t.util.addListener(this.hiddenTextarea,"compositionend",this.onCompositionEnd.bind(this)),!this._clickHandlerInitialized&&this.canvas&&(t.util.addListener(this.canvas.upperCanvasEl,"click",this.onClick.bind(this)),this._clickHandlerInitialized=!0)},keysMap:{9:"exitEditing",27:"exitEditing",33:"moveCursorUp",34:"moveCursorDown",35:"moveCursorRight",36:"moveCursorLeft",37:"moveCursorLeft",38:"moveCursorUp",39:"moveCursorRight",40:"moveCursorDown"},keysMapRtl:{9:"exitEditing",27:"exitEditing",33:"moveCursorUp",34:"moveCursorDown",35:"moveCursorLeft",36:"moveCursorRight",37:"moveCursorRight",38:"moveCursorUp",39:"moveCursorLeft",40:"moveCursorDown"},ctrlKeysMapUp:{67:"copy",88:"cut"},ctrlKeysMapDown:{65:"selectAll"},onClick:function(){this.hiddenTextarea&&this.hiddenTextarea.focus()},onKeyDown:function(a){if(!!this.isEditing){var o=this.direction==="rtl"?this.keysMapRtl:this.keysMap;if(a.keyCode in o)this[o[a.keyCode]](a);else if(a.keyCode in this.ctrlKeysMapDown&&(a.ctrlKey||a.metaKey))this[this.ctrlKeysMapDown[a.keyCode]](a);else return;a.stopImmediatePropagation(),a.preventDefault(),a.keyCode>=33&&a.keyCode<=40?(this.inCompositionMode=!1,this.clearContextTop(),this.renderCursorOrSelection()):this.canvas&&this.canvas.requestRenderAll()}},onKeyUp:function(a){if(!this.isEditing||this._copyDone||this.inCompositionMode){this._copyDone=!1;return}if(a.keyCode in this.ctrlKeysMapUp&&(a.ctrlKey||a.metaKey))this[this.ctrlKeysMapUp[a.keyCode]](a);else return;a.stopImmediatePropagation(),a.preventDefault(),this.canvas&&this.canvas.requestRenderAll()},onInput:function(a){var o=this.fromPaste;if(this.fromPaste=!1,a&&a.stopPropagation(),!!this.isEditing){var u=this._splitTextIntoLines(this.hiddenTextarea.value).graphemeText,h=this._text.length,c=u.length,f,s,d=c-h,v=this.selectionStart,g=this.selectionEnd,y=v!==g,b,_,w;if(this.hiddenTextarea.value===""){this.styles={},this.updateFromTextArea(),this.fire("changed"),this.canvas&&(this.canvas.fire("text:changed",{target:this}),this.canvas.requestRenderAll());return}var S=this.fromStringToGraphemeSelection(this.hiddenTextarea.selectionStart,this.hiddenTextarea.selectionEnd,this.hiddenTextarea.value),x=v>S.selectionStart;y?(f=this._text.slice(v,g),d+=g-v):c0&&(h=this.__charBounds[a][o-1],u+=h.left+h.width),u},getDownCursorOffset:function(a,o){var u=this._getSelectionForOffset(a,o),h=this.get2DCursorLocation(u),c=h.lineIndex;if(c===this._textLines.length-1||a.metaKey||a.keyCode===34)return this._text.length-u;var f=h.charIndex,s=this._getWidthBeforeCursor(c,f),d=this._getIndexOnLine(c+1,s),v=this._textLines[c].slice(f);return v.length+d+1+this.missingNewlineOffset(c)},_getSelectionForOffset:function(a,o){return a.shiftKey&&this.selectionStart!==this.selectionEnd&&o?this.selectionEnd:this.selectionStart},getUpCursorOffset:function(a,o){var u=this._getSelectionForOffset(a,o),h=this.get2DCursorLocation(u),c=h.lineIndex;if(c===0||a.metaKey||a.keyCode===33)return-u;var f=h.charIndex,s=this._getWidthBeforeCursor(c,f),d=this._getIndexOnLine(c-1,s),v=this._textLines[c].slice(0,f),g=this.missingNewlineOffset(c-1);return-this._textLines[c-1].length+d-v.length+(1-g)},_getIndexOnLine:function(a,o){for(var u=this._textLines[a],h=this._getLineLeftOffset(a),c=h,f=0,s,d,v=0,g=u.length;vo){d=!0;var y=c-s,b=c,_=Math.abs(y-o),w=Math.abs(b-o);f=w<_?v:v-1;break}return d||(f=u.length-1),f},moveCursorDown:function(a){this.selectionStart>=this._text.length&&this.selectionEnd>=this._text.length||this._moveCursorUpOrDown("Down",a)},moveCursorUp:function(a){this.selectionStart===0&&this.selectionEnd===0||this._moveCursorUpOrDown("Up",a)},_moveCursorUpOrDown:function(a,o){var u="get"+a+"CursorOffset",h=this[u](o,this._selectionDirection==="right");o.shiftKey?this.moveCursorWithShift(h):this.moveCursorWithoutShift(h),h!==0&&(this.setSelectionInBoundaries(),this.abortCursorAnimation(),this._currentCursorOpacity=1,this.initDelayedCursor(),this._fireSelectionChanged(),this._updateTextarea())},moveCursorWithShift:function(a){var o=this._selectionDirection==="left"?this.selectionStart+a:this.selectionEnd+a;return this.setSelectionStartEndWithShift(this.selectionStart,this.selectionEnd,o),a!==0},moveCursorWithoutShift:function(a){return a<0?(this.selectionStart+=a,this.selectionEnd=this.selectionStart):(this.selectionEnd+=a,this.selectionStart=this.selectionEnd),a!==0},moveCursorLeft:function(a){this.selectionStart===0&&this.selectionEnd===0||this._moveCursorLeftOrRight("Left",a)},_move:function(a,o,u){var h;if(a.altKey)h=this["findWordBoundary"+u](this[o]);else if(a.metaKey||a.keyCode===35||a.keyCode===36)h=this["findLineBoundary"+u](this[o]);else return this[o]+=u==="Left"?-1:1,!0;if(typeof h<"u"&&this[o]!==h)return this[o]=h,!0},_moveLeft:function(a,o){return this._move(a,o,"Left")},_moveRight:function(a,o){return this._move(a,o,"Right")},moveCursorLeftWithoutShift:function(a){var o=!0;return this._selectionDirection="left",this.selectionEnd===this.selectionStart&&this.selectionStart!==0&&(o=this._moveLeft(a,"selectionStart")),this.selectionEnd=this.selectionStart,o},moveCursorLeftWithShift:function(a){if(this._selectionDirection==="right"&&this.selectionStart!==this.selectionEnd)return this._moveLeft(a,"selectionEnd");if(this.selectionStart!==0)return this._selectionDirection="left",this._moveLeft(a,"selectionStart")},moveCursorRight:function(a){this.selectionStart>=this._text.length&&this.selectionEnd>=this._text.length||this._moveCursorLeftOrRight("Right",a)},_moveCursorLeftOrRight:function(a,o){var u="moveCursor"+a+"With";this._currentCursorOpacity=1,o.shiftKey?u+="Shift":u+="outShift",this[u](o)&&(this.abortCursorAnimation(),this.initDelayedCursor(),this._fireSelectionChanged(),this._updateTextarea())},moveCursorRightWithShift:function(a){if(this._selectionDirection==="left"&&this.selectionStart!==this.selectionEnd)return this._moveRight(a,"selectionStart");if(this.selectionEnd!==this._text.length)return this._selectionDirection="right",this._moveRight(a,"selectionEnd")},moveCursorRightWithoutShift:function(a){var o=!0;return this._selectionDirection="right",this.selectionStart===this.selectionEnd?(o=this._moveRight(a,"selectionStart"),this.selectionEnd=this.selectionStart):this.selectionStart=this.selectionEnd,o},removeChars:function(a,o){typeof o>"u"&&(o=a+1),this.removeStyleFromTo(a,o),this._text.splice(a,o-a),this.text=this._text.join(""),this.set("dirty",!0),this._shouldClearDimensionCache()&&(this.initDimensions(),this.setCoords()),this._removeExtraneousStyles()},insertChars:function(a,o,u,h){typeof h>"u"&&(h=u),h>u&&this.removeStyleFromTo(u,h);var c=t.util.string.graphemeSplit(a);this.insertNewStyleBlock(c,u,o),this._text=[].concat(this._text.slice(0,u),c,this._text.slice(h)),this.text=this._text.join(""),this.set("dirty",!0),this._shouldClearDimensionCache()&&(this.initDimensions(),this.setCoords()),this._removeExtraneousStyles()}}),function(){var a=t.util.toFixed,o=/ +/g;t.util.object.extend(t.Text.prototype,{_toSVG:function(){var u=this._getSVGLeftTopOffsets(),h=this._getSVGTextAndBg(u.textTop,u.textLeft);return this._wrapSVGTextAndBg(h)},toSVG:function(u){return this._createBaseSVGMarkup(this._toSVG(),{reviver:u,noStyle:!0,withShadow:!0})},_getSVGLeftTopOffsets:function(){return{textLeft:-this.width/2,textTop:-this.height/2,lineTop:this.getHeightOfLine(0)}},_wrapSVGTextAndBg:function(u){var h=!0,c=this.getSvgTextDecoration(this);return[u.textBgRects.join(""),' ",u.textSpans.join(""),` `]},_getSVGTextAndBg:function(u,h){var c=[],f=[],s=u,d;this._setSVGBg(f);for(var v=0,g=this._textLines.length;v",t.util.string.escapeXml(u),""].join("")},_setSVGTextLineText:function(u,h,c,f){var s=this.getHeightOfLine(h),d=this.textAlign.indexOf("justify")!==-1,v,g,y="",b,_,w=0,S=this._textLines[h],x;f+=s*(1-this._fontSizeFraction)/this.lineHeight;for(var T=0,O=S.length-1;T<=O;T++)x=T===O||this.charSpacing,y+=S[T],b=this.__charBounds[h][T],w===0?(c+=b.kernedWidth-b.width,w+=b.width):w+=b.kernedWidth,d&&!x&&this._reSpaceAndTab.test(S[T])&&(x=!0),x||(v=v||this.getCompleteStyleDeclaration(h,T),g=this.getCompleteStyleDeclaration(h,T+1),x=t.util.hasStyleChanged(v,g,!0)),x&&(_=this._getStyleDeclaration(h,T)||{},u.push(this._createTextCharSpan(y,_,c,f)),y="",v=g,c+=w,w=0)},_pushTextBgRect:function(u,h,c,f,s,d){var v=t.Object.NUM_FRACTION_DIGITS;u.push(" `)},_setSVGTextLineBg:function(u,h,c,f){for(var s=this._textLines[h],d=this.getHeightOfLine(h)/this.lineHeight,v=0,g=0,y,b,_=this.getValueOfPropertyAt(h,0,"textBackgroundColor"),w=0,S=s.length;wthis.width&&this._set("width",this.dynamicMinWidth),this.textAlign.indexOf("justify")!==-1&&this.enlargeSpaces(),this.height=this.calcTextHeight(),this.saveState({propertySet:"_dimensionAffectingProps"}))},_generateStyleMap:function(u){for(var h=0,c=0,f=0,s={},d=0;d0?(c=0,f++,h++):!this.splitByGrapheme&&this._reSpaceAndTab.test(u.graphemeText[f])&&d>0&&(c++,f++),s[d]={line:h,offset:c},f+=u.graphemeLines[d].length,c+=u.graphemeLines[d].length;return s},styleHas:function(u,h){if(this._styleMap&&!this.isWrapping){var c=this._styleMap[h];c&&(h=c.line)}return o.Text.prototype.styleHas.call(this,u,h)},isEmptyStyles:function(u){if(!this.styles)return!0;var h=0,c=u+1,f,s,d=!1,v=this._styleMap[u],g=this._styleMap[u+1];v&&(u=v.line,h=v.offset),g&&(c=g.line,d=c===u,f=g.offset),s=typeof u>"u"?this.styles:{line:this.styles[u]};for(var y in s)for(var b in s[y])if(b>=h&&(!d||bc&&!O?(v.push(g),g=[],s=S,O=!0):s+=A,!O&&!d&&g.push(w),g=g.concat(b),x=d?0:this._measureWord([w],h,_),_++,O=!1,S>T&&(T=S);return N&&v.push(g),T+$>this.dynamicMinWidth&&(this.dynamicMinWidth=T-A+$),v},isEndOfWrapping:function(u){return!this._styleMap[u+1]||this._styleMap[u+1].line!==this._styleMap[u].line},missingNewlineOffset:function(u){return this.splitByGrapheme?this.isEndOfWrapping(u)?1:0:1},_splitTextIntoLines:function(u){for(var h=o.Text.prototype._splitTextIntoLines.call(this,u),c=this._wrapText(h.lines,this.width),f=new Array(c.length),s=0;s{const e=()=>({canvas:void 0,brush:void 0,visibleImageLayer:void 0,imageLayer:void 0,visibleDrawLayer:void 0,drawLayer:void 0,cropPreviewLayer:void 0,maskPathColor:"",maskBackgroundColor:"",imageScale:1,undoHistory:[],redoHistory:[],drawing:!1}),t=se({...e(),maskPathColor:"white",maskBackgroundColor:"black"}),n=se({...e(),maskPathColor:"black",maskBackgroundColor:"white"}),r=ee(()=>kn().generatorType==="Inpainting"),i=ee(()=>r.value?t.value:n.value),l=ee(()=>kn().currentImageProps),m=ee({get:()=>i.value.drawing&&!r.value,set:z=>i.value.drawing=z}),a=se(512),o=se(512),u=se(!1),h=se(30),c=se(!1),f=new Kn.fabric.Circle({radius:h.value,left:0,originX:"center",originY:"center",angle:0,fill:"",stroke:"red",strokeWidth:3,opacity:0}),s=se("Erase"),d=se("rgb(0, 0, 0, 1)");function v(){!i.value.canvas||i.value.canvas.renderAll()}function g(){u.value=!u.value,s.value=u.value?"Draw":"Erase"}function y(z=null){!i.value.canvas||(i.value.brush=i.value.canvas.freeDrawingBrush,i.value.brush.color=z||i.value.brush.color,i.value.brush.width=h.value)}async function b({history:z,erase:L=!1,draw:R=!1}={}){if(!z||!i.value.drawLayer||!i.value.visibleDrawLayer||!i.value.imageLayer||!i.value.visibleImageLayer||!i.value.canvas)return;z.path.selectable=!1,z.path.opacity=1,z.drawPath=await Q(z.path),z.visibleDrawPath=await Q(z.path),L?(z.visibleDrawPath.globalCompositeOperation="destination-out",z.drawPath.stroke=i.value.maskBackgroundColor):(z.visibleDrawPath.globalCompositeOperation="source-over",z.drawPath.stroke=R?d.value:i.value.maskPathColor);let Z=await Q(z.drawPath);Z=Z.scale(i.value.imageScale),Z.left=Z.left+z.drawPath.left*(i.value.imageScale-1),Z.top=Z.top+z.drawPath.top*(i.value.imageScale-1),R?(i.value.imageLayer.add(Z),i.value.visibleImageLayer.addWithUpdate(z.visibleDrawPath)):(i.value.drawLayer.add(Z),i.value.visibleDrawLayer.addWithUpdate(z.visibleDrawPath)),i.value.canvas.remove(z.path),v()}function _(){if(i.value.undoHistory.length===0)return;const z=i.value.undoHistory.pop();b({history:z,erase:!1,draw:m.value}),i.value.redoHistory.push(z)}function w(){if(i.value.redoHistory.length===0||!i.value.drawLayer||!i.value.visibleDrawLayer||!i.value.imageLayer||!i.value.visibleImageLayer||!i.value.canvas)return;const z=i.value.redoHistory.pop();i.value.undoHistory.push(z),m.value?(i.value.imageLayer.remove(z.drawPath),i.value.visibleImageLayer.remove(z.visibleDrawPath)):(i.value.drawLayer.remove(z.drawPath),i.value.visibleDrawLayer.remove(z.visibleDrawPath)),delete z.drawPath,delete z.visibleDrawPath,v()}function S(z){i.value.canvas=new Kn.fabric.Canvas(z,{isDrawingMode:!1,width:a.value,height:o.value,backgroundColor:"white"}),i.value.canvas.selection=!1,i.value.canvas.freeDrawingCursor="crosshair",y(i.value.maskPathColor),i.value.canvas.on("mouse:move",I),i.value.canvas.on("path:created",le),v()}function x(z,L,R,Z){let V=Z,P=Z;return L>R?(z.scaleToWidth(Z),V=Z*(o.value/a.value)):(z.scaleToHeight(Z),P=Z*(a.value/o.value)),{newHeight:V,newWidth:P}}function T(z){const L=kn();if(E(),z.selectable=!1,a.value=z.width,o.value=z.height,a.value>L.maxDimensions||o.value>L.maxDimensions){const{newHeight:Z,newWidth:V}=x(z,a.value,o.value,L.maxDimensions);a.value=V,o.value=Z}if(a.value{a.value>o.value?i.value.imageScale=a.value/R:i.value.imageScale=o.value/R,i.value.imageLayer=D({image:Z,layerHeight:Z.height,layerWidth:Z.width})}),z.cloneAsImage(Z=>{if(!i.value.canvas)return;if(a.value!==R||o.value!==R){const{newHeight:q,newWidth:J}=x(Z,a.value,o.value,R);a.value=J,o.value=q}i.value.canvas.setWidth(a.value),i.value.canvas.setHeight(o.value),i.value.canvas.isDrawingMode=!0,i.value.visibleDrawLayer=F(),i.value.visibleImageLayer=F({image:Z}),i.value.drawLayer=D();const V=a.value*i.value.imageScale,P=o.value*i.value.imageScale;L.params.width=V-V%64,L.params.height=P-P%64,i.value.visibleDrawLayer.set("opacity",.8),i.value.canvas.add(i.value.visibleImageLayer),i.value.canvas.add(i.value.visibleDrawLayer),i.value.canvas.add(f),c.value=!0,$(),O()})}function O(){const z=kn();if(!i.value.imageLayer||!i.value.drawLayer)return;const L=i.value.imageLayer.getCenter().left-z.params.width/2,R=z.params.width,Z=i.value.imageLayer.getCenter().top-z.params.height/2,V=z.params.height,P={format:"jpeg",quality:1,left:L,top:Z,width:R,height:V};l.value.sourceImage=i.value.imageLayer.toDataURL(P),l.value.maskImage=i.value.redoHistory.length===0||m.value?void 0:i.value.drawLayer.toDataURL(P).split(",")[1]}let A;function $(){if(!i.value.canvas)return;const z=kn();i.value.cropPreviewLayer&&(i.value.canvas.remove(i.value.cropPreviewLayer),i.value.cropPreviewLayer=void 0),c.value&&(i.value.cropPreviewLayer=F({layerWidth:z.params.width/i.value.imageScale,layerHeight:z.params.height/i.value.imageScale,fill:"rgba(100, 0, 0, 0.5)"}),i.value.canvas.centerObject(i.value.cropPreviewLayer),i.value.canvas.add(i.value.cropPreviewLayer),A&&clearTimeout(A),A=setTimeout(()=>{c.value=!1,$(),A=void 0},5e3))}function N(z,L){const R="data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAAAEAAAABCAYAAAAfFcSJAAAAAXNSR0IArs4c6QAAAA1JREFUGFdj+P///38ACfsD/QVDRcoAAAAASUVORK5CYII=";Kn.fabric.Image.fromURL(R,Z=>{Z.set({height:z,width:L});const V=Z.toDataURL({format:"png"});l.value.sourceImage=V,m.value=!0,T(Z)})}function D({image:z,layerWidth:L,layerHeight:R}={}){const Z=new Kn.fabric.Canvas(null);return Z.selection=!1,Z.backgroundColor=i.value.maskBackgroundColor,Z.setHeight(R||o.value),Z.setWidth(L||a.value),z&&Z.add(z),Z}function F({image:z,layerWidth:L,layerHeight:R,fill:Z,abosolute:V}={}){const P=z||new Kn.fabric.Rect({width:L||a.value,height:R||o.value,left:0,top:0,fill:Z||"transparent",absolutePositioned:V||!0,selectable:!1});return new Kn.fabric.Group([P],{selectable:!1,absolutePositioned:V||!0})}function E(){!i.value.canvas||(i.value.visibleImageLayer&&(i.value.canvas.remove(i.value.visibleImageLayer),i.value.visibleImageLayer=void 0),i.value.visibleDrawLayer&&(i.value.canvas.remove(i.value.visibleDrawLayer),i.value.visibleDrawLayer=void 0),i.value.imageLayer=void 0,i.value.drawLayer=void 0,i.value.redoHistory=[],i.value.undoHistory=[],i.value.canvas.isDrawingMode=!1)}function H(){if(!!i.value.canvas){if(i.value.visibleDrawLayer&&(i.value.canvas.remove(i.value.visibleDrawLayer),i.value.visibleDrawLayer=void 0),m.value){const z=kn();N(z.params.height||512,z.params.width||512)}i.value.drawLayer=void 0,i.value.redoHistory=[],i.value.undoHistory=[],i.value.visibleDrawLayer=F(),i.value.drawLayer=D(),i.value.visibleDrawLayer.set("opacity",.8),i.value.canvas.add(i.value.visibleDrawLayer)}}function re(){var L;O();const z=document.createElement("a");if(m.value){z.href="data:image/png;base64,"+((L=l.value.sourceImage)==null?void 0:L.split(",")[1]),z.download="image_drawing.png",z.click();return}z.href="data:image/png;base64,"+l.value.maskImage,z.download="image_mask.png",z.click()}async function Q(z){return new Promise((L,R)=>{try{z.clone(L)}catch(Z){R(Z)}})}async function le(z){const L={path:z.path};b({history:L,erase:u.value,draw:m.value}),i.value.redoHistory.push(L)}function I(z){if(!i.value.canvas)return;const L=i.value.canvas.getPointer(z.e);f.left=L.x,f.top=L.y,f.opacity=.8,u.value?(f.set("strokeWidth",3),f.set("fill",""),y("red")):(f.set("strokeWidth",0),m.value?(f.set("fill",d.value),y(d.value)):(f.set("fill","white"),y("white"))),f.set("radius",h.value/2),v()}return{showCropPreview:c,erasing:u,switchToolText:s,brushSize:h,drawColor:d,drawing:m,imageProps:i,updateCropPreview:$,createNewCanvas:S,downloadMask:re,resetCanvas:E,resetDrawing:H,flipErase:g,undoAction:w,redoAction:_,newImage:T,newBlankImage:N,setBrush:y,saveImages:O}});const _H={},wH={xmlns:"http://www.w3.org/2000/svg","xmlns:xlink":"http://www.w3.org/1999/xlink",viewBox:"0 0 20 20"},CH=ae("g",{fill:"none"},[ae("path",{d:"M11.197 2.44a1.5 1.5 0 0 1 2.121 0l4.243 4.242a1.5 1.5 0 0 1 0 2.121L9.364 17H14.5a.5.5 0 0 1 0 1H7.82a1.496 1.496 0 0 1-1.14-.437L2.437 13.32a1.5 1.5 0 0 1 0-2.121l8.76-8.76zm1.414.706a.5.5 0 0 0-.707 0L5.538 9.512l4.95 4.95l6.366-6.366a.5.5 0 0 0 0-.707L12.61 3.146zM9.781 15.17l-4.95-4.95l-1.687 1.687a.5.5 0 0 0 0 .707l4.243 4.243a.5.5 0 0 0 .707 0l1.687-1.687z",fill:"currentColor"})],-1),SH=[CH];function xH(e,t){return j(),ce("svg",wH,SH)}const TH=Yt(_H,[["render",xH]]);async function kH(e,t){const n=document.createElement("canvas"),r=n.getContext("2d"),i=new Image;return i.src=e,await new Promise(m=>i.onload=m),n.width=i.width,n.height=i.height,r==null||r.drawImage(i,0,0),n.toDataURL(t)}async function EH(e,t){const n=e.split(";base64,"),r=t!=null?t:n[0].split(":")[1],i=window.atob(r===n[0].split(":")[1]?n[1]:(await kH(e,r)).split(",")[1]),l=new Uint8Array(i.length);for(let m=0;m{const r=new FileReader;r.onload=()=>t(r.result),r.onerror=i=>n(i),r.readAsDataURL(e)})}const Jp=e=>(Gr("data-v-d200c279"),e=e(),qr(),e),OH=Jp(()=>ae("div",null,[Ye("Drop file here OR "),ae("em",null,"click to upload")],-1)),AH={key:0},PH=Jp(()=>ae("div",{class:"center-horizontal",style:{"margin-top":"5px"}},"OR",-1)),IH={class:"canvas-container"},MH=Jp(()=>ae("canvas",{id:"canvas"},null,-1)),LH={class:"action-buttons",style:{left:"10px",right:"unset"}},RH={class:"action-buttons"},DH=Te({__name:"CustomCanvas",setup(e){const t=kn(),n=$t(),r=hs(),i=se();async function l(a){if(!a.raw.type.includes("image")){n.raiseError("Uploaded file needs to be a image!",!1),i.value.clearFiles();return}const o=await t2(a.raw);t.currentImageProps.sourceImage=o,r.drawing=!1,Kn.fabric.Image.fromURL(o,r.newImage)}function m(){t.currentImageProps.sourceImage="",r.resetCanvas()}return Ze(()=>{r.createNewCanvas("canvas"),t.currentImageProps.sourceImage&&Kn.fabric.Image.fromURL(t.currentImageProps.sourceImage,r.newImage)}),(a,o)=>(j(),ce(ze,null,[C(t).currentImageProps.sourceImage?be("",!0):(j(),_e(C(Op),{key:0,drag:"",ref_key:"upload",ref:i,"auto-upload":!1,onChange:l,limit:1,multiple:""},{tip:pe(()=>[C(t).generatorType==="Img2Img"?(j(),ce("div",AH,[PH,ae("div",{class:"center-both",style:{cursor:"pointer","text-decoration":"underline","font-size":"1rem"},onClick:o[0]||(o[0]=u=>C(r).newBlankImage(C(t).params.height||512,C(t).params.width||512))},[ue(C(Le),{size:20,style:{"margin-right":"2px"}},{default:pe(()=>[ue(Jw)]),_:1}),Ye("draw something")])])):be("",!0)]),default:pe(()=>[ue(C(Le),{size:100},{default:pe(()=>[ue(C(Yh))]),_:1}),OH]),_:1},512)),gt(ae("div",null,[ae("div",IH,[MH,ae("div",LH,[ue(C(ut),{onClick:o[1]||(o[1]=u=>C(r).undoAction()),icon:C(Xb),plain:"",disabled:C(r).imageProps.redoHistory.length===0},null,8,["icon","disabled"]),ue(C(ut),{onClick:o[2]||(o[2]=u=>C(r).redoAction()),icon:C(Kb),plain:"",disabled:C(r).imageProps.undoHistory.length===0},null,8,["icon","disabled"])]),ae("div",RH,[ue(C(ut),{onClick:o[3]||(o[3]=u=>C(r).resetDrawing()),icon:C(yr),plain:""},null,8,["icon"]),ue(C(ut),{onClick:m,icon:C(xc),plain:""},null,8,["icon"]),ue(C(ut),{onClick:o[4]||(o[4]=u=>C(r).downloadMask()),icon:C(As),plain:""},null,8,["icon"]),ue(C(ut),{onClick:o[5]||(o[5]=u=>C(r).flipErase()),icon:C(r).erasing?C(yE):TH,plain:""},null,8,["icon"]),C(r).drawing?(j(),_e(C(Q$),{key:0,modelValue:C(r).drawColor,"onUpdate:modelValue":o[6]||(o[6]=u=>C(r).drawColor=u),"show-alpha":""},null,8,["modelValue"])):be("",!0)]),ue(C(Cp),{"label-width":"110px",style:{"margin-top":"10px"}},{default:pe(()=>[ue(Rn,{style:{"margin-bottom":"5px"},label:"Brush Size",prop:"brushSize",modelValue:C(r).brushSize,"onUpdate:modelValue":o[7]||(o[7]=u=>C(r).brushSize=u),min:10,max:100,step:10,change:C(r).setBrush},null,8,["modelValue","change"])]),_:1})])],512),[[Rt,C(t).currentImageProps.sourceImage]])],64))}});const x0=Yt(DH,[["__scopeId","data-v-d200c279"]]),$H={class:"centerIcons"},BH={class:"stackedIcons"},FH=Te({__name:"StackedIcon",props:{iconOne:null,iconTwo:null,size:null},setup(e){const t=e;return tx(n=>({"2ad037ca":e.size+"px"})),(n,r)=>(j(),ce("div",$H,[ae("div",BH,[ue(C(Le),{class:"firstIcon",size:e.size},{default:pe(()=>[(j(),_e(bt(t.iconOne)))]),_:1},8,["size"]),ue(C(Le),{class:"secondIcon",size:e.size},{default:pe(()=>[(j(),_e(bt(t.iconTwo)))]),_:1},8,["size"])])]))}});const zH=Yt(FH,[["__scopeId","data-v-74586a39"]]),NH={key:1,style:{width:"40px"}},eu=Te({__name:"GeneratorMenuItem",props:{index:null,iconOne:null,iconTwo:null,isMobile:{type:Boolean}},setup(e){const t=e;return(n,r)=>(j(),_e(C(Sr),{content:e.index,placement:e.isMobile?"bottom":"right",enterable:!1,"hide-after":100},{default:pe(()=>[ue(C(Tp),{index:e.index,style:{height:"60px",display:"flex","justify-content":"center"}},{default:pe(()=>[e.iconTwo?(j(),_e(zH,{key:0,iconOne:e.iconOne,iconTwo:e.iconTwo,size:40},null,8,["iconOne","iconTwo"])):(j(),ce("div",NH,[ue(C(Le),{style:{width:"35px"},size:40},{default:pe(()=>[(j(),_e(bt(t.iconOne)))]),_:1})]))]),_:1},8,["index"])]),_:1},8,["content","placement"]))}});/*! pako 2.1.0 https://github.com/nodeca/pako @license (MIT AND Zlib) */const jH=4,T0=0,k0=1,VH=2;function Aa(e){let t=e.length;for(;--t>=0;)e[t]=0}const UH=0,n2=1,HH=2,WH=3,YH=258,Qp=29,wl=256,qs=wl+1+Qp,ea=30,eg=19,r2=2*qs+1,no=15,Af=16,XH=7,tg=256,i2=16,o2=17,a2=18,ah=new Uint8Array([0,0,0,0,0,0,0,0,1,1,1,1,2,2,2,2,3,3,3,3,4,4,4,4,5,5,5,5,0]),Eu=new Uint8Array([0,0,0,0,1,1,2,2,3,3,4,4,5,5,6,6,7,7,8,8,9,9,10,10,11,11,12,12,13,13]),KH=new Uint8Array([0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,2,3,7]),s2=new Uint8Array([16,17,18,0,8,7,9,6,10,5,11,4,12,3,13,2,14,1,15]),GH=512,Dr=new Array((qs+2)*2);Aa(Dr);const gs=new Array(ea*2);Aa(gs);const Zs=new Array(GH);Aa(Zs);const Js=new Array(YH-WH+1);Aa(Js);const ng=new Array(Qp);Aa(ng);const ic=new Array(ea);Aa(ic);function Pf(e,t,n,r,i){this.static_tree=e,this.extra_bits=t,this.extra_base=n,this.elems=r,this.max_length=i,this.has_stree=e&&e.length}let l2,u2,c2;function If(e,t){this.dyn_tree=e,this.max_code=0,this.stat_desc=t}const f2=e=>e<256?Zs[e]:Zs[256+(e>>>7)],Qs=(e,t)=>{e.pending_buf[e.pending++]=t&255,e.pending_buf[e.pending++]=t>>>8&255},pn=(e,t,n)=>{e.bi_valid>Af-n?(e.bi_buf|=t<>Af-e.bi_valid,e.bi_valid+=n-Af):(e.bi_buf|=t<{pn(e,n[t*2],n[t*2+1])},d2=(e,t)=>{let n=0;do n|=e&1,e>>>=1,n<<=1;while(--t>0);return n>>>1},qH=e=>{e.bi_valid===16?(Qs(e,e.bi_buf),e.bi_buf=0,e.bi_valid=0):e.bi_valid>=8&&(e.pending_buf[e.pending++]=e.bi_buf&255,e.bi_buf>>=8,e.bi_valid-=8)},ZH=(e,t)=>{const n=t.dyn_tree,r=t.max_code,i=t.stat_desc.static_tree,l=t.stat_desc.has_stree,m=t.stat_desc.extra_bits,a=t.stat_desc.extra_base,o=t.stat_desc.max_length;let u,h,c,f,s,d,v=0;for(f=0;f<=no;f++)e.bl_count[f]=0;for(n[e.heap[e.heap_max]*2+1]=0,u=e.heap_max+1;uo&&(f=o,v++),n[h*2+1]=f,!(h>r)&&(e.bl_count[f]++,s=0,h>=a&&(s=m[h-a]),d=n[h*2],e.opt_len+=d*(f+s),l&&(e.static_len+=d*(i[h*2+1]+s)));if(v!==0){do{for(f=o-1;e.bl_count[f]===0;)f--;e.bl_count[f]--,e.bl_count[f+1]+=2,e.bl_count[o]--,v-=2}while(v>0);for(f=o;f!==0;f--)for(h=e.bl_count[f];h!==0;)c=e.heap[--u],!(c>r)&&(n[c*2+1]!==f&&(e.opt_len+=(f-n[c*2+1])*n[c*2],n[c*2+1]=f),h--)}},h2=(e,t,n)=>{const r=new Array(no+1);let i=0,l,m;for(l=1;l<=no;l++)i=i+n[l-1]<<1,r[l]=i;for(m=0;m<=t;m++){let a=e[m*2+1];a!==0&&(e[m*2]=d2(r[a]++,a))}},JH=()=>{let e,t,n,r,i;const l=new Array(no+1);for(n=0,r=0;r>=7;r{let t;for(t=0;t{e.bi_valid>8?Qs(e,e.bi_buf):e.bi_valid>0&&(e.pending_buf[e.pending++]=e.bi_buf),e.bi_buf=0,e.bi_valid=0},E0=(e,t,n,r)=>{const i=t*2,l=n*2;return e[i]{const r=e.heap[n];let i=n<<1;for(;i<=e.heap_len&&(i{let r,i,l=0,m,a;if(e.sym_next!==0)do r=e.pending_buf[e.sym_buf+l++]&255,r+=(e.pending_buf[e.sym_buf+l++]&255)<<8,i=e.pending_buf[e.sym_buf+l++],r===0?dr(e,i,t):(m=Js[i],dr(e,m+wl+1,t),a=ah[m],a!==0&&(i-=ng[m],pn(e,i,a)),r--,m=f2(r),dr(e,m,n),a=Eu[m],a!==0&&(r-=ic[m],pn(e,r,a)));while(l{const n=t.dyn_tree,r=t.stat_desc.static_tree,i=t.stat_desc.has_stree,l=t.stat_desc.elems;let m,a,o=-1,u;for(e.heap_len=0,e.heap_max=r2,m=0;m>1;m>=1;m--)Mf(e,n,m);u=l;do m=e.heap[1],e.heap[1]=e.heap[e.heap_len--],Mf(e,n,1),a=e.heap[1],e.heap[--e.heap_max]=m,e.heap[--e.heap_max]=a,n[u*2]=n[m*2]+n[a*2],e.depth[u]=(e.depth[m]>=e.depth[a]?e.depth[m]:e.depth[a])+1,n[m*2+1]=n[a*2+1]=u,e.heap[1]=u++,Mf(e,n,1);while(e.heap_len>=2);e.heap[--e.heap_max]=e.heap[1],ZH(e,t),h2(n,o,e.bl_count)},A0=(e,t,n)=>{let r,i=-1,l,m=t[0*2+1],a=0,o=7,u=4;for(m===0&&(o=138,u=3),t[(n+1)*2+1]=65535,r=0;r<=n;r++)l=m,m=t[(r+1)*2+1],!(++a{let r,i=-1,l,m=t[0*2+1],a=0,o=7,u=4;for(m===0&&(o=138,u=3),r=0;r<=n;r++)if(l=m,m=t[(r+1)*2+1],!(++a{let t;for(A0(e,e.dyn_ltree,e.l_desc.max_code),A0(e,e.dyn_dtree,e.d_desc.max_code),sh(e,e.bl_desc),t=eg-1;t>=3&&e.bl_tree[s2[t]*2+1]===0;t--);return e.opt_len+=3*(t+1)+5+5+4,t},eW=(e,t,n,r)=>{let i;for(pn(e,t-257,5),pn(e,n-1,5),pn(e,r-4,4),i=0;i{let t=4093624447,n;for(n=0;n<=31;n++,t>>>=1)if(t&1&&e.dyn_ltree[n*2]!==0)return T0;if(e.dyn_ltree[9*2]!==0||e.dyn_ltree[10*2]!==0||e.dyn_ltree[13*2]!==0)return k0;for(n=32;n{I0||(JH(),I0=!0),e.l_desc=new If(e.dyn_ltree,l2),e.d_desc=new If(e.dyn_dtree,u2),e.bl_desc=new If(e.bl_tree,c2),e.bi_buf=0,e.bi_valid=0,p2(e)},v2=(e,t,n,r)=>{pn(e,(UH<<1)+(r?1:0),3),g2(e),Qs(e,n),Qs(e,~n),n&&e.pending_buf.set(e.window.subarray(t,t+n),e.pending),e.pending+=n},rW=e=>{pn(e,n2<<1,3),dr(e,tg,Dr),qH(e)},iW=(e,t,n,r)=>{let i,l,m=0;e.level>0?(e.strm.data_type===VH&&(e.strm.data_type=tW(e)),sh(e,e.l_desc),sh(e,e.d_desc),m=QH(e),i=e.opt_len+3+7>>>3,l=e.static_len+3+7>>>3,l<=i&&(i=l)):i=l=n+5,n+4<=i&&t!==-1?v2(e,t,n,r):e.strategy===jH||l===i?(pn(e,(n2<<1)+(r?1:0),3),O0(e,Dr,gs)):(pn(e,(HH<<1)+(r?1:0),3),eW(e,e.l_desc.max_code+1,e.d_desc.max_code+1,m+1),O0(e,e.dyn_ltree,e.dyn_dtree)),p2(e),r&&g2(e)},oW=(e,t,n)=>(e.pending_buf[e.sym_buf+e.sym_next++]=t,e.pending_buf[e.sym_buf+e.sym_next++]=t>>8,e.pending_buf[e.sym_buf+e.sym_next++]=n,t===0?e.dyn_ltree[n*2]++:(e.matches++,t--,e.dyn_ltree[(Js[n]+wl+1)*2]++,e.dyn_dtree[f2(t)*2]++),e.sym_next===e.sym_end);var aW=nW,sW=v2,lW=iW,uW=oW,cW=rW,fW={_tr_init:aW,_tr_stored_block:sW,_tr_flush_block:lW,_tr_tally:uW,_tr_align:cW};const dW=(e,t,n,r)=>{let i=e&65535|0,l=e>>>16&65535|0,m=0;for(;n!==0;){m=n>2e3?2e3:n,n-=m;do i=i+t[r++]|0,l=l+i|0;while(--m);i%=65521,l%=65521}return i|l<<16|0};var el=dW;const hW=()=>{let e,t=[];for(var n=0;n<256;n++){e=n;for(var r=0;r<8;r++)e=e&1?3988292384^e>>>1:e>>>1;t[n]=e}return t},pW=new Uint32Array(hW()),gW=(e,t,n,r)=>{const i=pW,l=r+n;e^=-1;for(let m=r;m>>8^i[(e^t[m])&255];return e^-1};var Vt=gW,bo={2:"need dictionary",1:"stream end",0:"","-1":"file error","-2":"stream error","-3":"data error","-4":"insufficient memory","-5":"buffer error","-6":"incompatible version"},Pa={Z_NO_FLUSH:0,Z_PARTIAL_FLUSH:1,Z_SYNC_FLUSH:2,Z_FULL_FLUSH:3,Z_FINISH:4,Z_BLOCK:5,Z_TREES:6,Z_OK:0,Z_STREAM_END:1,Z_NEED_DICT:2,Z_ERRNO:-1,Z_STREAM_ERROR:-2,Z_DATA_ERROR:-3,Z_MEM_ERROR:-4,Z_BUF_ERROR:-5,Z_NO_COMPRESSION:0,Z_BEST_SPEED:1,Z_BEST_COMPRESSION:9,Z_DEFAULT_COMPRESSION:-1,Z_FILTERED:1,Z_HUFFMAN_ONLY:2,Z_RLE:3,Z_FIXED:4,Z_DEFAULT_STRATEGY:0,Z_BINARY:0,Z_TEXT:1,Z_UNKNOWN:2,Z_DEFLATED:8};const{_tr_init:vW,_tr_stored_block:lh,_tr_flush_block:mW,_tr_tally:Ci,_tr_align:yW}=fW,{Z_NO_FLUSH:Si,Z_PARTIAL_FLUSH:bW,Z_FULL_FLUSH:_W,Z_FINISH:Bn,Z_BLOCK:M0,Z_OK:Xt,Z_STREAM_END:L0,Z_STREAM_ERROR:vr,Z_DATA_ERROR:wW,Z_BUF_ERROR:Lf,Z_DEFAULT_COMPRESSION:CW,Z_FILTERED:SW,Z_HUFFMAN_ONLY:tu,Z_RLE:xW,Z_FIXED:TW,Z_DEFAULT_STRATEGY:kW,Z_UNKNOWN:EW,Z_DEFLATED:Nc}=Pa,OW=9,AW=15,PW=8,IW=29,MW=256,uh=MW+1+IW,LW=30,RW=19,DW=2*uh+1,$W=15,rt=3,yi=258,mr=yi+rt+1,BW=32,ga=42,rg=57,ch=69,fh=73,dh=91,hh=103,ro=113,Ka=666,un=1,Ia=2,_o=3,Ma=4,FW=3,io=(e,t)=>(e.msg=bo[t],t),R0=e=>e*2-(e>4?9:0),gi=e=>{let t=e.length;for(;--t>=0;)e[t]=0},zW=e=>{let t,n,r,i=e.w_size;t=e.hash_size,r=t;do n=e.head[--r],e.head[r]=n>=i?n-i:0;while(--t);t=i,r=t;do n=e.prev[--r],e.prev[r]=n>=i?n-i:0;while(--t)};let NW=(e,t,n)=>(t<{const t=e.state;let n=t.pending;n>e.avail_out&&(n=e.avail_out),n!==0&&(e.output.set(t.pending_buf.subarray(t.pending_out,t.pending_out+n),e.next_out),e.next_out+=n,t.pending_out+=n,e.total_out+=n,e.avail_out-=n,t.pending-=n,t.pending===0&&(t.pending_out=0))},On=(e,t)=>{mW(e,e.block_start>=0?e.block_start:-1,e.strstart-e.block_start,t),e.block_start=e.strstart,Sn(e.strm)},dt=(e,t)=>{e.pending_buf[e.pending++]=t},Va=(e,t)=>{e.pending_buf[e.pending++]=t>>>8&255,e.pending_buf[e.pending++]=t&255},ph=(e,t,n,r)=>{let i=e.avail_in;return i>r&&(i=r),i===0?0:(e.avail_in-=i,t.set(e.input.subarray(e.next_in,e.next_in+i),n),e.state.wrap===1?e.adler=el(e.adler,t,i,n):e.state.wrap===2&&(e.adler=Vt(e.adler,t,i,n)),e.next_in+=i,e.total_in+=i,i)},m2=(e,t)=>{let n=e.max_chain_length,r=e.strstart,i,l,m=e.prev_length,a=e.nice_match;const o=e.strstart>e.w_size-mr?e.strstart-(e.w_size-mr):0,u=e.window,h=e.w_mask,c=e.prev,f=e.strstart+yi;let s=u[r+m-1],d=u[r+m];e.prev_length>=e.good_match&&(n>>=2),a>e.lookahead&&(a=e.lookahead);do if(i=t,!(u[i+m]!==d||u[i+m-1]!==s||u[i]!==u[r]||u[++i]!==u[r+1])){r+=2,i++;do;while(u[++r]===u[++i]&&u[++r]===u[++i]&&u[++r]===u[++i]&&u[++r]===u[++i]&&u[++r]===u[++i]&&u[++r]===u[++i]&&u[++r]===u[++i]&&u[++r]===u[++i]&&rm){if(e.match_start=t,m=l,l>=a)break;s=u[r+m-1],d=u[r+m]}}while((t=c[t&h])>o&&--n!==0);return m<=e.lookahead?m:e.lookahead},va=e=>{const t=e.w_size;let n,r,i;do{if(r=e.window_size-e.lookahead-e.strstart,e.strstart>=t+(t-mr)&&(e.window.set(e.window.subarray(t,t+t-r),0),e.match_start-=t,e.strstart-=t,e.block_start-=t,e.insert>e.strstart&&(e.insert=e.strstart),zW(e),r+=t),e.strm.avail_in===0)break;if(n=ph(e.strm,e.window,e.strstart+e.lookahead,r),e.lookahead+=n,e.lookahead+e.insert>=rt)for(i=e.strstart-e.insert,e.ins_h=e.window[i],e.ins_h=xi(e,e.ins_h,e.window[i+1]);e.insert&&(e.ins_h=xi(e,e.ins_h,e.window[i+rt-1]),e.prev[i&e.w_mask]=e.head[e.ins_h],e.head[e.ins_h]=i,i++,e.insert--,!(e.lookahead+e.insert{let n=e.pending_buf_size-5>e.w_size?e.w_size:e.pending_buf_size-5,r,i,l,m=0,a=e.strm.avail_in;do{if(r=65535,l=e.bi_valid+42>>3,e.strm.avail_outi+e.strm.avail_in&&(r=i+e.strm.avail_in),r>l&&(r=l),r>8,e.pending_buf[e.pending-2]=~r,e.pending_buf[e.pending-1]=~r>>8,Sn(e.strm),i&&(i>r&&(i=r),e.strm.output.set(e.window.subarray(e.block_start,e.block_start+i),e.strm.next_out),e.strm.next_out+=i,e.strm.avail_out-=i,e.strm.total_out+=i,e.block_start+=i,r-=i),r&&(ph(e.strm,e.strm.output,e.strm.next_out,r),e.strm.next_out+=r,e.strm.avail_out-=r,e.strm.total_out+=r)}while(m===0);return a-=e.strm.avail_in,a&&(a>=e.w_size?(e.matches=2,e.window.set(e.strm.input.subarray(e.strm.next_in-e.w_size,e.strm.next_in),0),e.strstart=e.w_size,e.insert=e.strstart):(e.window_size-e.strstart<=a&&(e.strstart-=e.w_size,e.window.set(e.window.subarray(e.w_size,e.w_size+e.strstart),0),e.matches<2&&e.matches++,e.insert>e.strstart&&(e.insert=e.strstart)),e.window.set(e.strm.input.subarray(e.strm.next_in-a,e.strm.next_in),e.strstart),e.strstart+=a,e.insert+=a>e.w_size-e.insert?e.w_size-e.insert:a),e.block_start=e.strstart),e.high_waterl&&e.block_start>=e.w_size&&(e.block_start-=e.w_size,e.strstart-=e.w_size,e.window.set(e.window.subarray(e.w_size,e.w_size+e.strstart),0),e.matches<2&&e.matches++,l+=e.w_size,e.insert>e.strstart&&(e.insert=e.strstart)),l>e.strm.avail_in&&(l=e.strm.avail_in),l&&(ph(e.strm,e.window,e.strstart,l),e.strstart+=l,e.insert+=l>e.w_size-e.insert?e.w_size-e.insert:l),e.high_water>3,l=e.pending_buf_size-l>65535?65535:e.pending_buf_size-l,n=l>e.w_size?e.w_size:l,i=e.strstart-e.block_start,(i>=n||(i||t===Bn)&&t!==Si&&e.strm.avail_in===0&&i<=l)&&(r=i>l?l:i,m=t===Bn&&e.strm.avail_in===0&&r===i?1:0,lh(e,e.block_start,r,m),e.block_start+=r,Sn(e.strm)),m?_o:un)},Rf=(e,t)=>{let n,r;for(;;){if(e.lookahead=rt&&(e.ins_h=xi(e,e.ins_h,e.window[e.strstart+rt-1]),n=e.prev[e.strstart&e.w_mask]=e.head[e.ins_h],e.head[e.ins_h]=e.strstart),n!==0&&e.strstart-n<=e.w_size-mr&&(e.match_length=m2(e,n)),e.match_length>=rt)if(r=Ci(e,e.strstart-e.match_start,e.match_length-rt),e.lookahead-=e.match_length,e.match_length<=e.max_lazy_match&&e.lookahead>=rt){e.match_length--;do e.strstart++,e.ins_h=xi(e,e.ins_h,e.window[e.strstart+rt-1]),n=e.prev[e.strstart&e.w_mask]=e.head[e.ins_h],e.head[e.ins_h]=e.strstart;while(--e.match_length!==0);e.strstart++}else e.strstart+=e.match_length,e.match_length=0,e.ins_h=e.window[e.strstart],e.ins_h=xi(e,e.ins_h,e.window[e.strstart+1]);else r=Ci(e,0,e.window[e.strstart]),e.lookahead--,e.strstart++;if(r&&(On(e,!1),e.strm.avail_out===0))return un}return e.insert=e.strstart{let n,r,i;for(;;){if(e.lookahead=rt&&(e.ins_h=xi(e,e.ins_h,e.window[e.strstart+rt-1]),n=e.prev[e.strstart&e.w_mask]=e.head[e.ins_h],e.head[e.ins_h]=e.strstart),e.prev_length=e.match_length,e.prev_match=e.match_start,e.match_length=rt-1,n!==0&&e.prev_length4096)&&(e.match_length=rt-1)),e.prev_length>=rt&&e.match_length<=e.prev_length){i=e.strstart+e.lookahead-rt,r=Ci(e,e.strstart-1-e.prev_match,e.prev_length-rt),e.lookahead-=e.prev_length-1,e.prev_length-=2;do++e.strstart<=i&&(e.ins_h=xi(e,e.ins_h,e.window[e.strstart+rt-1]),n=e.prev[e.strstart&e.w_mask]=e.head[e.ins_h],e.head[e.ins_h]=e.strstart);while(--e.prev_length!==0);if(e.match_available=0,e.match_length=rt-1,e.strstart++,r&&(On(e,!1),e.strm.avail_out===0))return un}else if(e.match_available){if(r=Ci(e,0,e.window[e.strstart-1]),r&&On(e,!1),e.strstart++,e.lookahead--,e.strm.avail_out===0)return un}else e.match_available=1,e.strstart++,e.lookahead--}return e.match_available&&(r=Ci(e,0,e.window[e.strstart-1]),e.match_available=0),e.insert=e.strstart{let n,r,i,l;const m=e.window;for(;;){if(e.lookahead<=yi){if(va(e),e.lookahead<=yi&&t===Si)return un;if(e.lookahead===0)break}if(e.match_length=0,e.lookahead>=rt&&e.strstart>0&&(i=e.strstart-1,r=m[i],r===m[++i]&&r===m[++i]&&r===m[++i])){l=e.strstart+yi;do;while(r===m[++i]&&r===m[++i]&&r===m[++i]&&r===m[++i]&&r===m[++i]&&r===m[++i]&&r===m[++i]&&r===m[++i]&&ie.lookahead&&(e.match_length=e.lookahead)}if(e.match_length>=rt?(n=Ci(e,1,e.match_length-rt),e.lookahead-=e.match_length,e.strstart+=e.match_length,e.match_length=0):(n=Ci(e,0,e.window[e.strstart]),e.lookahead--,e.strstart++),n&&(On(e,!1),e.strm.avail_out===0))return un}return e.insert=0,t===Bn?(On(e,!0),e.strm.avail_out===0?_o:Ma):e.sym_next&&(On(e,!1),e.strm.avail_out===0)?un:Ia},VW=(e,t)=>{let n;for(;;){if(e.lookahead===0&&(va(e),e.lookahead===0)){if(t===Si)return un;break}if(e.match_length=0,n=Ci(e,0,e.window[e.strstart]),e.lookahead--,e.strstart++,n&&(On(e,!1),e.strm.avail_out===0))return un}return e.insert=0,t===Bn?(On(e,!0),e.strm.avail_out===0?_o:Ma):e.sym_next&&(On(e,!1),e.strm.avail_out===0)?un:Ia};function lr(e,t,n,r,i){this.good_length=e,this.max_lazy=t,this.nice_length=n,this.max_chain=r,this.func=i}const Ga=[new lr(0,0,0,0,y2),new lr(4,4,8,4,Rf),new lr(4,5,16,8,Rf),new lr(4,6,32,32,Rf),new lr(4,4,16,16,No),new lr(8,16,32,32,No),new lr(8,16,128,128,No),new lr(8,32,128,256,No),new lr(32,128,258,1024,No),new lr(32,258,258,4096,No)],UW=e=>{e.window_size=2*e.w_size,gi(e.head),e.max_lazy_match=Ga[e.level].max_lazy,e.good_match=Ga[e.level].good_length,e.nice_match=Ga[e.level].nice_length,e.max_chain_length=Ga[e.level].max_chain,e.strstart=0,e.block_start=0,e.lookahead=0,e.insert=0,e.match_length=e.prev_length=rt-1,e.match_available=0,e.ins_h=0};function HW(){this.strm=null,this.status=0,this.pending_buf=null,this.pending_buf_size=0,this.pending_out=0,this.pending=0,this.wrap=0,this.gzhead=null,this.gzindex=0,this.method=Nc,this.last_flush=-1,this.w_size=0,this.w_bits=0,this.w_mask=0,this.window=null,this.window_size=0,this.prev=null,this.head=null,this.ins_h=0,this.hash_size=0,this.hash_bits=0,this.hash_mask=0,this.hash_shift=0,this.block_start=0,this.match_length=0,this.prev_match=0,this.match_available=0,this.strstart=0,this.match_start=0,this.lookahead=0,this.prev_length=0,this.max_chain_length=0,this.max_lazy_match=0,this.level=0,this.strategy=0,this.good_match=0,this.nice_match=0,this.dyn_ltree=new Uint16Array(DW*2),this.dyn_dtree=new Uint16Array((2*LW+1)*2),this.bl_tree=new Uint16Array((2*RW+1)*2),gi(this.dyn_ltree),gi(this.dyn_dtree),gi(this.bl_tree),this.l_desc=null,this.d_desc=null,this.bl_desc=null,this.bl_count=new Uint16Array($W+1),this.heap=new Uint16Array(2*uh+1),gi(this.heap),this.heap_len=0,this.heap_max=0,this.depth=new Uint16Array(2*uh+1),gi(this.depth),this.sym_buf=0,this.lit_bufsize=0,this.sym_next=0,this.sym_end=0,this.opt_len=0,this.static_len=0,this.matches=0,this.insert=0,this.bi_buf=0,this.bi_valid=0}const Cl=e=>{if(!e)return 1;const t=e.state;return!t||t.strm!==e||t.status!==ga&&t.status!==rg&&t.status!==ch&&t.status!==fh&&t.status!==dh&&t.status!==hh&&t.status!==ro&&t.status!==Ka?1:0},b2=e=>{if(Cl(e))return io(e,vr);e.total_in=e.total_out=0,e.data_type=EW;const t=e.state;return t.pending=0,t.pending_out=0,t.wrap<0&&(t.wrap=-t.wrap),t.status=t.wrap===2?rg:t.wrap?ga:ro,e.adler=t.wrap===2?0:1,t.last_flush=-2,vW(t),Xt},_2=e=>{const t=b2(e);return t===Xt&&UW(e.state),t},WW=(e,t)=>Cl(e)||e.state.wrap!==2?vr:(e.state.gzhead=t,Xt),w2=(e,t,n,r,i,l)=>{if(!e)return vr;let m=1;if(t===CW&&(t=6),r<0?(m=0,r=-r):r>15&&(m=2,r-=16),i<1||i>OW||n!==Nc||r<8||r>15||t<0||t>9||l<0||l>TW||r===8&&m!==1)return io(e,vr);r===8&&(r=9);const a=new HW;return e.state=a,a.strm=e,a.status=ga,a.wrap=m,a.gzhead=null,a.w_bits=r,a.w_size=1<w2(e,t,Nc,AW,PW,kW),XW=(e,t)=>{if(Cl(e)||t>M0||t<0)return e?io(e,vr):vr;const n=e.state;if(!e.output||e.avail_in!==0&&!e.input||n.status===Ka&&t!==Bn)return io(e,e.avail_out===0?Lf:vr);const r=n.last_flush;if(n.last_flush=t,n.pending!==0){if(Sn(e),e.avail_out===0)return n.last_flush=-1,Xt}else if(e.avail_in===0&&R0(t)<=R0(r)&&t!==Bn)return io(e,Lf);if(n.status===Ka&&e.avail_in!==0)return io(e,Lf);if(n.status===ga&&n.wrap===0&&(n.status=ro),n.status===ga){let i=Nc+(n.w_bits-8<<4)<<8,l=-1;if(n.strategy>=tu||n.level<2?l=0:n.level<6?l=1:n.level===6?l=2:l=3,i|=l<<6,n.strstart!==0&&(i|=BW),i+=31-i%31,Va(n,i),n.strstart!==0&&(Va(n,e.adler>>>16),Va(n,e.adler&65535)),e.adler=1,n.status=ro,Sn(e),n.pending!==0)return n.last_flush=-1,Xt}if(n.status===rg){if(e.adler=0,dt(n,31),dt(n,139),dt(n,8),n.gzhead)dt(n,(n.gzhead.text?1:0)+(n.gzhead.hcrc?2:0)+(n.gzhead.extra?4:0)+(n.gzhead.name?8:0)+(n.gzhead.comment?16:0)),dt(n,n.gzhead.time&255),dt(n,n.gzhead.time>>8&255),dt(n,n.gzhead.time>>16&255),dt(n,n.gzhead.time>>24&255),dt(n,n.level===9?2:n.strategy>=tu||n.level<2?4:0),dt(n,n.gzhead.os&255),n.gzhead.extra&&n.gzhead.extra.length&&(dt(n,n.gzhead.extra.length&255),dt(n,n.gzhead.extra.length>>8&255)),n.gzhead.hcrc&&(e.adler=Vt(e.adler,n.pending_buf,n.pending,0)),n.gzindex=0,n.status=ch;else if(dt(n,0),dt(n,0),dt(n,0),dt(n,0),dt(n,0),dt(n,n.level===9?2:n.strategy>=tu||n.level<2?4:0),dt(n,FW),n.status=ro,Sn(e),n.pending!==0)return n.last_flush=-1,Xt}if(n.status===ch){if(n.gzhead.extra){let i=n.pending,l=(n.gzhead.extra.length&65535)-n.gzindex;for(;n.pending+l>n.pending_buf_size;){let a=n.pending_buf_size-n.pending;if(n.pending_buf.set(n.gzhead.extra.subarray(n.gzindex,n.gzindex+a),n.pending),n.pending=n.pending_buf_size,n.gzhead.hcrc&&n.pending>i&&(e.adler=Vt(e.adler,n.pending_buf,n.pending-i,i)),n.gzindex+=a,Sn(e),n.pending!==0)return n.last_flush=-1,Xt;i=0,l-=a}let m=new Uint8Array(n.gzhead.extra);n.pending_buf.set(m.subarray(n.gzindex,n.gzindex+l),n.pending),n.pending+=l,n.gzhead.hcrc&&n.pending>i&&(e.adler=Vt(e.adler,n.pending_buf,n.pending-i,i)),n.gzindex=0}n.status=fh}if(n.status===fh){if(n.gzhead.name){let i=n.pending,l;do{if(n.pending===n.pending_buf_size){if(n.gzhead.hcrc&&n.pending>i&&(e.adler=Vt(e.adler,n.pending_buf,n.pending-i,i)),Sn(e),n.pending!==0)return n.last_flush=-1,Xt;i=0}n.gzindexi&&(e.adler=Vt(e.adler,n.pending_buf,n.pending-i,i)),n.gzindex=0}n.status=dh}if(n.status===dh){if(n.gzhead.comment){let i=n.pending,l;do{if(n.pending===n.pending_buf_size){if(n.gzhead.hcrc&&n.pending>i&&(e.adler=Vt(e.adler,n.pending_buf,n.pending-i,i)),Sn(e),n.pending!==0)return n.last_flush=-1,Xt;i=0}n.gzindexi&&(e.adler=Vt(e.adler,n.pending_buf,n.pending-i,i))}n.status=hh}if(n.status===hh){if(n.gzhead.hcrc){if(n.pending+2>n.pending_buf_size&&(Sn(e),n.pending!==0))return n.last_flush=-1,Xt;dt(n,e.adler&255),dt(n,e.adler>>8&255),e.adler=0}if(n.status=ro,Sn(e),n.pending!==0)return n.last_flush=-1,Xt}if(e.avail_in!==0||n.lookahead!==0||t!==Si&&n.status!==Ka){let i=n.level===0?y2(n,t):n.strategy===tu?VW(n,t):n.strategy===xW?jW(n,t):Ga[n.level].func(n,t);if((i===_o||i===Ma)&&(n.status=Ka),i===un||i===_o)return e.avail_out===0&&(n.last_flush=-1),Xt;if(i===Ia&&(t===bW?yW(n):t!==M0&&(lh(n,0,0,!1),t===_W&&(gi(n.head),n.lookahead===0&&(n.strstart=0,n.block_start=0,n.insert=0))),Sn(e),e.avail_out===0))return n.last_flush=-1,Xt}return t!==Bn?Xt:n.wrap<=0?L0:(n.wrap===2?(dt(n,e.adler&255),dt(n,e.adler>>8&255),dt(n,e.adler>>16&255),dt(n,e.adler>>24&255),dt(n,e.total_in&255),dt(n,e.total_in>>8&255),dt(n,e.total_in>>16&255),dt(n,e.total_in>>24&255)):(Va(n,e.adler>>>16),Va(n,e.adler&65535)),Sn(e),n.wrap>0&&(n.wrap=-n.wrap),n.pending!==0?Xt:L0)},KW=e=>{if(Cl(e))return vr;const t=e.state.status;return e.state=null,t===ro?io(e,wW):Xt},GW=(e,t)=>{let n=t.length;if(Cl(e))return vr;const r=e.state,i=r.wrap;if(i===2||i===1&&r.status!==ga||r.lookahead)return vr;if(i===1&&(e.adler=el(e.adler,t,n,0)),r.wrap=0,n>=r.w_size){i===0&&(gi(r.head),r.strstart=0,r.block_start=0,r.insert=0);let o=new Uint8Array(r.w_size);o.set(t.subarray(n-r.w_size,n),0),t=o,n=r.w_size}const l=e.avail_in,m=e.next_in,a=e.input;for(e.avail_in=n,e.next_in=0,e.input=t,va(r);r.lookahead>=rt;){let o=r.strstart,u=r.lookahead-(rt-1);do r.ins_h=xi(r,r.ins_h,r.window[o+rt-1]),r.prev[o&r.w_mask]=r.head[r.ins_h],r.head[r.ins_h]=o,o++;while(--u);r.strstart=o,r.lookahead=rt-1,va(r)}return r.strstart+=r.lookahead,r.block_start=r.strstart,r.insert=r.lookahead,r.lookahead=0,r.match_length=r.prev_length=rt-1,r.match_available=0,e.next_in=m,e.input=a,e.avail_in=l,r.wrap=i,Xt};var qW=YW,ZW=w2,JW=_2,QW=b2,eY=WW,tY=XW,nY=KW,rY=GW,iY="pako deflate (from Nodeca project)",vs={deflateInit:qW,deflateInit2:ZW,deflateReset:JW,deflateResetKeep:QW,deflateSetHeader:eY,deflate:tY,deflateEnd:nY,deflateSetDictionary:rY,deflateInfo:iY};const oY=(e,t)=>Object.prototype.hasOwnProperty.call(e,t);var aY=function(e){const t=Array.prototype.slice.call(arguments,1);for(;t.length;){const n=t.shift();if(!!n){if(typeof n!="object")throw new TypeError(n+"must be non-object");for(const r in n)oY(n,r)&&(e[r]=n[r])}}return e},sY=e=>{let t=0;for(let r=0,i=e.length;r=252?6:e>=248?5:e>=240?4:e>=224?3:e>=192?2:1;tl[254]=tl[254]=1;var lY=e=>{if(typeof TextEncoder=="function"&&TextEncoder.prototype.encode)return new TextEncoder().encode(e);let t,n,r,i,l,m=e.length,a=0;for(i=0;i>>6,t[l++]=128|n&63):n<65536?(t[l++]=224|n>>>12,t[l++]=128|n>>>6&63,t[l++]=128|n&63):(t[l++]=240|n>>>18,t[l++]=128|n>>>12&63,t[l++]=128|n>>>6&63,t[l++]=128|n&63);return t};const uY=(e,t)=>{if(t<65534&&e.subarray&&C2)return String.fromCharCode.apply(null,e.length===t?e:e.subarray(0,t));let n="";for(let r=0;r{const n=t||e.length;if(typeof TextDecoder=="function"&&TextDecoder.prototype.decode)return new TextDecoder().decode(e.subarray(0,t));let r,i;const l=new Array(n*2);for(i=0,r=0;r4){l[i++]=65533,r+=a-1;continue}for(m&=a===2?31:a===3?15:7;a>1&&r1){l[i++]=65533;continue}m<65536?l[i++]=m:(m-=65536,l[i++]=55296|m>>10&1023,l[i++]=56320|m&1023)}return uY(l,i)},fY=(e,t)=>{t=t||e.length,t>e.length&&(t=e.length);let n=t-1;for(;n>=0&&(e[n]&192)===128;)n--;return n<0||n===0?t:n+tl[e[n]]>t?n:t},nl={string2buf:lY,buf2string:cY,utf8border:fY};function dY(){this.input=null,this.next_in=0,this.avail_in=0,this.total_in=0,this.output=null,this.next_out=0,this.avail_out=0,this.total_out=0,this.msg="",this.state=null,this.data_type=2,this.adler=0}var S2=dY;const x2=Object.prototype.toString,{Z_NO_FLUSH:hY,Z_SYNC_FLUSH:pY,Z_FULL_FLUSH:gY,Z_FINISH:vY,Z_OK:oc,Z_STREAM_END:mY,Z_DEFAULT_COMPRESSION:yY,Z_DEFAULT_STRATEGY:bY,Z_DEFLATED:_Y}=Pa;function Sl(e){this.options=jc.assign({level:yY,method:_Y,chunkSize:16384,windowBits:15,memLevel:8,strategy:bY},e||{});let t=this.options;t.raw&&t.windowBits>0?t.windowBits=-t.windowBits:t.gzip&&t.windowBits>0&&t.windowBits<16&&(t.windowBits+=16),this.err=0,this.msg="",this.ended=!1,this.chunks=[],this.strm=new S2,this.strm.avail_out=0;let n=vs.deflateInit2(this.strm,t.level,t.method,t.windowBits,t.memLevel,t.strategy);if(n!==oc)throw new Error(bo[n]);if(t.header&&vs.deflateSetHeader(this.strm,t.header),t.dictionary){let r;if(typeof t.dictionary=="string"?r=nl.string2buf(t.dictionary):x2.call(t.dictionary)==="[object ArrayBuffer]"?r=new Uint8Array(t.dictionary):r=t.dictionary,n=vs.deflateSetDictionary(this.strm,r),n!==oc)throw new Error(bo[n]);this._dict_set=!0}}Sl.prototype.push=function(e,t){const n=this.strm,r=this.options.chunkSize;let i,l;if(this.ended)return!1;for(t===~~t?l=t:l=t===!0?vY:hY,typeof e=="string"?n.input=nl.string2buf(e):x2.call(e)==="[object ArrayBuffer]"?n.input=new Uint8Array(e):n.input=e,n.next_in=0,n.avail_in=n.input.length;;){if(n.avail_out===0&&(n.output=new Uint8Array(r),n.next_out=0,n.avail_out=r),(l===pY||l===gY)&&n.avail_out<=6){this.onData(n.output.subarray(0,n.next_out)),n.avail_out=0;continue}if(i=vs.deflate(n,l),i===mY)return n.next_out>0&&this.onData(n.output.subarray(0,n.next_out)),i=vs.deflateEnd(this.strm),this.onEnd(i),this.ended=!0,i===oc;if(n.avail_out===0){this.onData(n.output);continue}if(l>0&&n.next_out>0){this.onData(n.output.subarray(0,n.next_out)),n.avail_out=0;continue}if(n.avail_in===0)break}return!0};Sl.prototype.onData=function(e){this.chunks.push(e)};Sl.prototype.onEnd=function(e){e===oc&&(this.result=jc.flattenChunks(this.chunks)),this.chunks=[],this.err=e,this.msg=this.strm.msg};function ig(e,t){const n=new Sl(t);if(n.push(e,!0),n.err)throw n.msg||bo[n.err];return n.result}function wY(e,t){return t=t||{},t.raw=!0,ig(e,t)}function CY(e,t){return t=t||{},t.gzip=!0,ig(e,t)}var SY=Sl,xY=ig,TY=wY,kY=CY,EY=Pa,OY={Deflate:SY,deflate:xY,deflateRaw:TY,gzip:kY,constants:EY};const nu=16209,AY=16191;var PY=function(t,n){let r,i,l,m,a,o,u,h,c,f,s,d,v,g,y,b,_,w,S,x,T,O,A,$;const N=t.state;r=t.next_in,A=t.input,i=r+(t.avail_in-5),l=t.next_out,$=t.output,m=l-(n-t.avail_out),a=l+(t.avail_out-257),o=N.dmax,u=N.wsize,h=N.whave,c=N.wnext,f=N.window,s=N.hold,d=N.bits,v=N.lencode,g=N.distcode,y=(1<>>24,s>>>=w,d-=w,w=_>>>16&255,w===0)$[l++]=_&65535;else if(w&16){S=_&65535,w&=15,w&&(d>>=w,d-=w),d<15&&(s+=A[r++]<>>24,s>>>=w,d-=w,w=_>>>16&255,w&16){if(x=_&65535,w&=15,do){t.msg="invalid distance too far back",N.mode=nu;break e}if(s>>>=w,d-=w,w=l-m,x>w){if(w=x-w,w>h&&N.sane){t.msg="invalid distance too far back",N.mode=nu;break e}if(T=0,O=f,c===0){if(T+=u-w,w2;)$[l++]=O[T++],$[l++]=O[T++],$[l++]=O[T++],S-=3;S&&($[l++]=O[T++],S>1&&($[l++]=O[T++]))}else{T=l-x;do $[l++]=$[T++],$[l++]=$[T++],$[l++]=$[T++],S-=3;while(S>2);S&&($[l++]=$[T++],S>1&&($[l++]=$[T++]))}}else if((w&64)===0){_=g[(_&65535)+(s&(1<>3,r-=S,d-=S<<3,s&=(1<{const o=a.bits;let u=0,h=0,c=0,f=0,s=0,d=0,v=0,g=0,y=0,b=0,_,w,S,x,T,O=null,A;const $=new Uint16Array(jo+1),N=new Uint16Array(jo+1);let D=null,F,E,H;for(u=0;u<=jo;u++)$[u]=0;for(h=0;h=1&&$[f]===0;f--);if(s>f&&(s=f),f===0)return i[l++]=1<<24|64<<16|0,i[l++]=1<<24|64<<16|0,a.bits=1,0;for(c=1;c0&&(e===B0||f!==1))return-1;for(N[1]=0,u=1;uD0||e===F0&&y>$0)return 1;for(;;){F=u-v,m[h]+1=A?(E=D[m[h]-A],H=O[m[h]-A]):(E=32+64,H=0),_=1<>v)+w]=F<<24|E<<16|H|0;while(w!==0);for(_=1<>=1;if(_!==0?(b&=_-1,b+=_):b=0,h++,--$[u]===0){if(u===f)break;u=t[n+m[h]]}if(u>s&&(b&x)!==S){for(v===0&&(v=s),T+=c,d=u-v,g=1<D0||e===F0&&y>$0)return 1;S=b&x,i[S]=s<<24|d<<16|T-l|0}}return b!==0&&(i[T+b]=u-v<<24|64<<16|0),a.bits=s,0};var ms=DY;const $Y=0,T2=1,k2=2,{Z_FINISH:z0,Z_BLOCK:BY,Z_TREES:ru,Z_OK:wo,Z_STREAM_END:FY,Z_NEED_DICT:zY,Z_STREAM_ERROR:Un,Z_DATA_ERROR:E2,Z_MEM_ERROR:O2,Z_BUF_ERROR:NY,Z_DEFLATED:N0}=Pa,Vc=16180,j0=16181,V0=16182,U0=16183,H0=16184,W0=16185,Y0=16186,X0=16187,K0=16188,G0=16189,ac=16190,Ar=16191,$f=16192,q0=16193,Bf=16194,Z0=16195,J0=16196,Q0=16197,ey=16198,iu=16199,ou=16200,ty=16201,ny=16202,ry=16203,iy=16204,oy=16205,Ff=16206,ay=16207,sy=16208,Pt=16209,A2=16210,P2=16211,jY=852,VY=592,UY=15,HY=UY,ly=e=>(e>>>24&255)+(e>>>8&65280)+((e&65280)<<8)+((e&255)<<24);function WY(){this.strm=null,this.mode=0,this.last=!1,this.wrap=0,this.havedict=!1,this.flags=0,this.dmax=0,this.check=0,this.total=0,this.head=null,this.wbits=0,this.wsize=0,this.whave=0,this.wnext=0,this.window=null,this.hold=0,this.bits=0,this.length=0,this.offset=0,this.extra=0,this.lencode=null,this.distcode=null,this.lenbits=0,this.distbits=0,this.ncode=0,this.nlen=0,this.ndist=0,this.have=0,this.next=null,this.lens=new Uint16Array(320),this.work=new Uint16Array(288),this.lendyn=null,this.distdyn=null,this.sane=0,this.back=0,this.was=0}const Mo=e=>{if(!e)return 1;const t=e.state;return!t||t.strm!==e||t.modeP2?1:0},I2=e=>{if(Mo(e))return Un;const t=e.state;return e.total_in=e.total_out=t.total=0,e.msg="",t.wrap&&(e.adler=t.wrap&1),t.mode=Vc,t.last=0,t.havedict=0,t.flags=-1,t.dmax=32768,t.head=null,t.hold=0,t.bits=0,t.lencode=t.lendyn=new Int32Array(jY),t.distcode=t.distdyn=new Int32Array(VY),t.sane=1,t.back=-1,wo},M2=e=>{if(Mo(e))return Un;const t=e.state;return t.wsize=0,t.whave=0,t.wnext=0,I2(e)},L2=(e,t)=>{let n;if(Mo(e))return Un;const r=e.state;return t<0?(n=0,t=-t):(n=(t>>4)+5,t<48&&(t&=15)),t&&(t<8||t>15)?Un:(r.window!==null&&r.wbits!==t&&(r.window=null),r.wrap=n,r.wbits=t,M2(e))},R2=(e,t)=>{if(!e)return Un;const n=new WY;e.state=n,n.strm=e,n.window=null,n.mode=Vc;const r=L2(e,t);return r!==wo&&(e.state=null),r},YY=e=>R2(e,HY);let uy=!0,zf,Nf;const XY=e=>{if(uy){zf=new Int32Array(512),Nf=new Int32Array(32);let t=0;for(;t<144;)e.lens[t++]=8;for(;t<256;)e.lens[t++]=9;for(;t<280;)e.lens[t++]=7;for(;t<288;)e.lens[t++]=8;for(ms(T2,e.lens,0,288,zf,0,e.work,{bits:9}),t=0;t<32;)e.lens[t++]=5;ms(k2,e.lens,0,32,Nf,0,e.work,{bits:5}),uy=!1}e.lencode=zf,e.lenbits=9,e.distcode=Nf,e.distbits=5},D2=(e,t,n,r)=>{let i;const l=e.state;return l.window===null&&(l.wsize=1<=l.wsize?(l.window.set(t.subarray(n-l.wsize,n),0),l.wnext=0,l.whave=l.wsize):(i=l.wsize-l.wnext,i>r&&(i=r),l.window.set(t.subarray(n-r,n-r+i),l.wnext),r-=i,r?(l.window.set(t.subarray(n-r,n),0),l.wnext=r,l.whave=l.wsize):(l.wnext+=i,l.wnext===l.wsize&&(l.wnext=0),l.whave{let n,r,i,l,m,a,o,u,h,c,f,s,d,v,g=0,y,b,_,w,S,x,T,O;const A=new Uint8Array(4);let $,N;const D=new Uint8Array([16,17,18,0,8,7,9,6,10,5,11,4,12,3,13,2,14,1,15]);if(Mo(e)||!e.output||!e.input&&e.avail_in!==0)return Un;n=e.state,n.mode===Ar&&(n.mode=$f),m=e.next_out,i=e.output,o=e.avail_out,l=e.next_in,r=e.input,a=e.avail_in,u=n.hold,h=n.bits,c=a,f=o,O=wo;e:for(;;)switch(n.mode){case Vc:if(n.wrap===0){n.mode=$f;break}for(;h<16;){if(a===0)break e;a--,u+=r[l++]<>>8&255,n.check=Vt(n.check,A,2,0),u=0,h=0,n.mode=j0;break}if(n.head&&(n.head.done=!1),!(n.wrap&1)||(((u&255)<<8)+(u>>8))%31){e.msg="incorrect header check",n.mode=Pt;break}if((u&15)!==N0){e.msg="unknown compression method",n.mode=Pt;break}if(u>>>=4,h-=4,T=(u&15)+8,n.wbits===0&&(n.wbits=T),T>15||T>n.wbits){e.msg="invalid window size",n.mode=Pt;break}n.dmax=1<>8&1),n.flags&512&&n.wrap&4&&(A[0]=u&255,A[1]=u>>>8&255,n.check=Vt(n.check,A,2,0)),u=0,h=0,n.mode=V0;case V0:for(;h<32;){if(a===0)break e;a--,u+=r[l++]<>>8&255,A[2]=u>>>16&255,A[3]=u>>>24&255,n.check=Vt(n.check,A,4,0)),u=0,h=0,n.mode=U0;case U0:for(;h<16;){if(a===0)break e;a--,u+=r[l++]<>8),n.flags&512&&n.wrap&4&&(A[0]=u&255,A[1]=u>>>8&255,n.check=Vt(n.check,A,2,0)),u=0,h=0,n.mode=H0;case H0:if(n.flags&1024){for(;h<16;){if(a===0)break e;a--,u+=r[l++]<>>8&255,n.check=Vt(n.check,A,2,0)),u=0,h=0}else n.head&&(n.head.extra=null);n.mode=W0;case W0:if(n.flags&1024&&(s=n.length,s>a&&(s=a),s&&(n.head&&(T=n.head.extra_len-n.length,n.head.extra||(n.head.extra=new Uint8Array(n.head.extra_len)),n.head.extra.set(r.subarray(l,l+s),T)),n.flags&512&&n.wrap&4&&(n.check=Vt(n.check,r,s,l)),a-=s,l+=s,n.length-=s),n.length))break e;n.length=0,n.mode=Y0;case Y0:if(n.flags&2048){if(a===0)break e;s=0;do T=r[l+s++],n.head&&T&&n.length<65536&&(n.head.name+=String.fromCharCode(T));while(T&&s>9&1,n.head.done=!0),e.adler=n.check=0,n.mode=Ar;break;case G0:for(;h<32;){if(a===0)break e;a--,u+=r[l++]<>>=h&7,h-=h&7,n.mode=Ff;break}for(;h<3;){if(a===0)break e;a--,u+=r[l++]<>>=1,h-=1,u&3){case 0:n.mode=q0;break;case 1:if(XY(n),n.mode=iu,t===ru){u>>>=2,h-=2;break e}break;case 2:n.mode=J0;break;case 3:e.msg="invalid block type",n.mode=Pt}u>>>=2,h-=2;break;case q0:for(u>>>=h&7,h-=h&7;h<32;){if(a===0)break e;a--,u+=r[l++]<>>16^65535)){e.msg="invalid stored block lengths",n.mode=Pt;break}if(n.length=u&65535,u=0,h=0,n.mode=Bf,t===ru)break e;case Bf:n.mode=Z0;case Z0:if(s=n.length,s){if(s>a&&(s=a),s>o&&(s=o),s===0)break e;i.set(r.subarray(l,l+s),m),a-=s,l+=s,o-=s,m+=s,n.length-=s;break}n.mode=Ar;break;case J0:for(;h<14;){if(a===0)break e;a--,u+=r[l++]<>>=5,h-=5,n.ndist=(u&31)+1,u>>>=5,h-=5,n.ncode=(u&15)+4,u>>>=4,h-=4,n.nlen>286||n.ndist>30){e.msg="too many length or distance symbols",n.mode=Pt;break}n.have=0,n.mode=Q0;case Q0:for(;n.have>>=3,h-=3}for(;n.have<19;)n.lens[D[n.have++]]=0;if(n.lencode=n.lendyn,n.lenbits=7,$={bits:n.lenbits},O=ms($Y,n.lens,0,19,n.lencode,0,n.work,$),n.lenbits=$.bits,O){e.msg="invalid code lengths set",n.mode=Pt;break}n.have=0,n.mode=ey;case ey:for(;n.have>>24,b=g>>>16&255,_=g&65535,!(y<=h);){if(a===0)break e;a--,u+=r[l++]<>>=y,h-=y,n.lens[n.have++]=_;else{if(_===16){for(N=y+2;h>>=y,h-=y,n.have===0){e.msg="invalid bit length repeat",n.mode=Pt;break}T=n.lens[n.have-1],s=3+(u&3),u>>>=2,h-=2}else if(_===17){for(N=y+3;h>>=y,h-=y,T=0,s=3+(u&7),u>>>=3,h-=3}else{for(N=y+7;h>>=y,h-=y,T=0,s=11+(u&127),u>>>=7,h-=7}if(n.have+s>n.nlen+n.ndist){e.msg="invalid bit length repeat",n.mode=Pt;break}for(;s--;)n.lens[n.have++]=T}}if(n.mode===Pt)break;if(n.lens[256]===0){e.msg="invalid code -- missing end-of-block",n.mode=Pt;break}if(n.lenbits=9,$={bits:n.lenbits},O=ms(T2,n.lens,0,n.nlen,n.lencode,0,n.work,$),n.lenbits=$.bits,O){e.msg="invalid literal/lengths set",n.mode=Pt;break}if(n.distbits=6,n.distcode=n.distdyn,$={bits:n.distbits},O=ms(k2,n.lens,n.nlen,n.ndist,n.distcode,0,n.work,$),n.distbits=$.bits,O){e.msg="invalid distances set",n.mode=Pt;break}if(n.mode=iu,t===ru)break e;case iu:n.mode=ou;case ou:if(a>=6&&o>=258){e.next_out=m,e.avail_out=o,e.next_in=l,e.avail_in=a,n.hold=u,n.bits=h,PY(e,f),m=e.next_out,i=e.output,o=e.avail_out,l=e.next_in,r=e.input,a=e.avail_in,u=n.hold,h=n.bits,n.mode===Ar&&(n.back=-1);break}for(n.back=0;g=n.lencode[u&(1<>>24,b=g>>>16&255,_=g&65535,!(y<=h);){if(a===0)break e;a--,u+=r[l++]<>w)],y=g>>>24,b=g>>>16&255,_=g&65535,!(w+y<=h);){if(a===0)break e;a--,u+=r[l++]<>>=w,h-=w,n.back+=w}if(u>>>=y,h-=y,n.back+=y,n.length=_,b===0){n.mode=oy;break}if(b&32){n.back=-1,n.mode=Ar;break}if(b&64){e.msg="invalid literal/length code",n.mode=Pt;break}n.extra=b&15,n.mode=ty;case ty:if(n.extra){for(N=n.extra;h>>=n.extra,h-=n.extra,n.back+=n.extra}n.was=n.length,n.mode=ny;case ny:for(;g=n.distcode[u&(1<>>24,b=g>>>16&255,_=g&65535,!(y<=h);){if(a===0)break e;a--,u+=r[l++]<>w)],y=g>>>24,b=g>>>16&255,_=g&65535,!(w+y<=h);){if(a===0)break e;a--,u+=r[l++]<>>=w,h-=w,n.back+=w}if(u>>>=y,h-=y,n.back+=y,b&64){e.msg="invalid distance code",n.mode=Pt;break}n.offset=_,n.extra=b&15,n.mode=ry;case ry:if(n.extra){for(N=n.extra;h>>=n.extra,h-=n.extra,n.back+=n.extra}if(n.offset>n.dmax){e.msg="invalid distance too far back",n.mode=Pt;break}n.mode=iy;case iy:if(o===0)break e;if(s=f-o,n.offset>s){if(s=n.offset-s,s>n.whave&&n.sane){e.msg="invalid distance too far back",n.mode=Pt;break}s>n.wnext?(s-=n.wnext,d=n.wsize-s):d=n.wnext-s,s>n.length&&(s=n.length),v=n.window}else v=i,d=m-n.offset,s=n.length;s>o&&(s=o),o-=s,n.length-=s;do i[m++]=v[d++];while(--s);n.length===0&&(n.mode=ou);break;case oy:if(o===0)break e;i[m++]=n.length,o--,n.mode=ou;break;case Ff:if(n.wrap){for(;h<32;){if(a===0)break e;a--,u|=r[l++]<{if(Mo(e))return Un;let t=e.state;return t.window&&(t.window=null),e.state=null,wo},qY=(e,t)=>{if(Mo(e))return Un;const n=e.state;return(n.wrap&2)===0?Un:(n.head=t,t.done=!1,wo)},ZY=(e,t)=>{const n=t.length;let r,i,l;return Mo(e)||(r=e.state,r.wrap!==0&&r.mode!==ac)?Un:r.mode===ac&&(i=1,i=el(i,t,n,0),i!==r.check)?E2:(l=D2(e,t,n,n),l?(r.mode=A2,O2):(r.havedict=1,wo))};var JY=M2,QY=L2,eX=I2,tX=YY,nX=R2,rX=KY,iX=GY,oX=qY,aX=ZY,sX="pako inflate (from Nodeca project)",$r={inflateReset:JY,inflateReset2:QY,inflateResetKeep:eX,inflateInit:tX,inflateInit2:nX,inflate:rX,inflateEnd:iX,inflateGetHeader:oX,inflateSetDictionary:aX,inflateInfo:sX};function lX(){this.text=0,this.time=0,this.xflags=0,this.os=0,this.extra=null,this.extra_len=0,this.name="",this.comment="",this.hcrc=0,this.done=!1}var uX=lX;const $2=Object.prototype.toString,{Z_NO_FLUSH:cX,Z_FINISH:fX,Z_OK:rl,Z_STREAM_END:jf,Z_NEED_DICT:Vf,Z_STREAM_ERROR:dX,Z_DATA_ERROR:cy,Z_MEM_ERROR:hX}=Pa;function xl(e){this.options=jc.assign({chunkSize:1024*64,windowBits:15,to:""},e||{});const t=this.options;t.raw&&t.windowBits>=0&&t.windowBits<16&&(t.windowBits=-t.windowBits,t.windowBits===0&&(t.windowBits=-15)),t.windowBits>=0&&t.windowBits<16&&!(e&&e.windowBits)&&(t.windowBits+=32),t.windowBits>15&&t.windowBits<48&&(t.windowBits&15)===0&&(t.windowBits|=15),this.err=0,this.msg="",this.ended=!1,this.chunks=[],this.strm=new S2,this.strm.avail_out=0;let n=$r.inflateInit2(this.strm,t.windowBits);if(n!==rl)throw new Error(bo[n]);if(this.header=new uX,$r.inflateGetHeader(this.strm,this.header),t.dictionary&&(typeof t.dictionary=="string"?t.dictionary=nl.string2buf(t.dictionary):$2.call(t.dictionary)==="[object ArrayBuffer]"&&(t.dictionary=new Uint8Array(t.dictionary)),t.raw&&(n=$r.inflateSetDictionary(this.strm,t.dictionary),n!==rl)))throw new Error(bo[n])}xl.prototype.push=function(e,t){const n=this.strm,r=this.options.chunkSize,i=this.options.dictionary;let l,m,a;if(this.ended)return!1;for(t===~~t?m=t:m=t===!0?fX:cX,$2.call(e)==="[object ArrayBuffer]"?n.input=new Uint8Array(e):n.input=e,n.next_in=0,n.avail_in=n.input.length;;){for(n.avail_out===0&&(n.output=new Uint8Array(r),n.next_out=0,n.avail_out=r),l=$r.inflate(n,m),l===Vf&&i&&(l=$r.inflateSetDictionary(n,i),l===rl?l=$r.inflate(n,m):l===cy&&(l=Vf));n.avail_in>0&&l===jf&&n.state.wrap>0&&e[n.next_in]!==0;)$r.inflateReset(n),l=$r.inflate(n,m);switch(l){case dX:case cy:case Vf:case hX:return this.onEnd(l),this.ended=!0,!1}if(a=n.avail_out,n.next_out&&(n.avail_out===0||l===jf))if(this.options.to==="string"){let o=nl.utf8border(n.output,n.next_out),u=n.next_out-o,h=nl.buf2string(n.output,o);n.next_out=u,n.avail_out=r-u,u&&n.output.set(n.output.subarray(o,o+u),0),this.onData(h)}else this.onData(n.output.length===n.next_out?n.output:n.output.subarray(0,n.next_out));if(!(l===rl&&a===0)){if(l===jf)return l=$r.inflateEnd(this.strm),this.onEnd(l),this.ended=!0,!0;if(n.avail_in===0)break}}return!0};xl.prototype.onData=function(e){this.chunks.push(e)};xl.prototype.onEnd=function(e){e===rl&&(this.options.to==="string"?this.result=this.chunks.join(""):this.result=jc.flattenChunks(this.chunks)),this.chunks=[],this.err=e,this.msg=this.strm.msg};function og(e,t){const n=new xl(t);if(n.push(e),n.err)throw n.msg||bo[n.err];return n.result}function pX(e,t){return t=t||{},t.raw=!0,og(e,t)}var gX=xl,vX=og,mX=pX,yX=og,bX=Pa,_X={Inflate:gX,inflate:vX,inflateRaw:mX,ungzip:yX,constants:bX};const{Deflate:dG,deflate:hG,deflateRaw:wX,gzip:pG}=OY,{Inflate:gG,inflate:vG,inflateRaw:CX,ungzip:mG}=_X;var SX=wX,xX=CX;function fy(e){const t=new Map;for(const n of e){const[r,i]=n.split("="),l=decodeURIComponent(i);t.set(r,l)}return t}const TX=function(){if(!window.location.search.includes("?"))return;const t=window.location.search.replace("?","").split("&");let n=fy(t);if(console.log("URL params:",n),n.get("share")){const l=xX(new Uint8Array(atob(n.get("share")).split("").map(m=>m.charCodeAt(0))),{to:"string"});if(!l){$t().raiseError("Error when trying to decode share parameter!",!1);return}n=fy(l.split("&")),console.log("Share URL params:",n)}const r={id:-1,image:"",prompt:n.get("prompt")||"",sampler_name:n.get("sampler_name")||"k_euler",seed:Number(n.get("seed"))||-1,steps:Number(n.get("steps")||30),cfg_scale:Number(n.get("cfg_scale")||7),height:Number(n.get("height")||512),width:Number(n.get("width")||512),clip_skip:Number(n.get("clip_skip")||0)};kn().generateText2Img(r,!1)},kX=10;function gh(e,t,n,r,i=l=>$t().raiseError(l,!1)){if(e.status===n&&t)return!0;if(!t.message)return i(`${r}: Got response code ${e.status}`);if(!t.errors)return i(`${r}: ${t.message}`);const l=Object.entries(t.errors).map(m=>`${m[0]} - ${m[1]}`).join(" | ");return i(`${r}: ${t.message} (${l})`)}const EX=ya("interrogate",()=>{const e=se({}),t=se(!1);async function n(m){$t().raiseError(m,!1),t.value=!1,e.value={}}async function r(){const m=en(),{source_image:a}=e.value;if(!a)return n("Failed to get interrogation ID: No image supplied.");t.value=!0;const o=await fetch(`${m.baseURL.length===0?".":m.baseURL}/sdapi/v1/interrogate`,{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify({image:a.split(",")[1],model:"clip"})}),u=await o.json();!gh(o,u,200,"Failed to get interrogation",n)||(e.value.id=u.id,e.value.status=u.caption)}function i(){e.value={},t.value=!1}function l(){return e.value.status||!1}return{currentInterrogation:e,interrogating:t,interrogateImage:r,getFormStatus:l,resetInterrogation:i}}),ag=e=>(Gr("data-v-db184ac6"),e=e(),qr(),e),OX={key:0,style:{"margin-top":"16px"}},AX=ag(()=>ae("div",null,[Ye("Drop file here OR "),ae("em",null,"click to upload")],-1)),PX={key:1,style:{"margin-top":"16px"}},IX={key:2},MX={style:{"margin-top":"8px"}},LX=ag(()=>ae("h2",{style:{margin:"16px 0 8px 0"}},"Interrogation Results",-1)),RX={key:0},DX=ag(()=>ae("h3",null,"Caption",-1)),$X={key:0},BX={key:1},FX=Te({__name:"InterrogationView",setup(e){const t=EX(),n=kn(),r=$t(),i=se();async function l(u){if(i.value.clearFiles(),!u.raw.type.includes("image")){r.raiseError("Uploaded file needs to be a image!",!1);return}const h=await t2(u.raw);t.currentInterrogation.source_image=h,t.interrogateImage()}function m(){n.generateText2Img({prompt:a.value})}const a=ee(()=>t.getFormStatus()),{ellipsis:o}=Qw();return(u,h)=>C(t).currentInterrogation.source_image?C(t).currentInterrogation.status?(j(),ce("div",IX,[ae("div",MX,[ue(C(ut),{icon:C(rs),onClick:C(t).resetInterrogation},{default:pe(()=>[Ye("New Interrogation")]),_:1},8,["icon","onClick"]),C(a)?(j(),_e(C(ut),{key:0,icon:C(rs),onClick:m,disabled:!C(a)},{default:pe(()=>[Ye("Text2Img (Caption)")]),_:1},8,["icon","disabled"])):be("",!0)]),LX,ue(C(Sp),{src:C(t).currentInterrogation.source_image,alt:"Uploaded Image"},null,8,["src"]),C(a)?(j(),ce("div",RX,[DX,C(a)?(j(),ce("div",BX,[ae("strong",null,Pe(C(a)),1)])):(j(),ce("div",$X,"Processing"+Pe(C(o)),1))])):be("",!0)])):(j(),ce("div",PX,[ae("strong",null,"Uploading image"+Pe(C(o)),1)])):(j(),ce("div",OX,[ae("div",null,[ue(C(Op),{onChange:l,"auto-upload":!1,limit:1,class:"interrogation-upload",ref_key:"upload",ref:i,multiple:"",drag:""},{default:pe(()=>[ue(C(Le),{size:100},{default:pe(()=>[ue(C(Yh))]),_:1}),AX]),_:1},512)])]))}});const zX=Yt(FX,[["__scopeId","data-v-db184ac6"]]);function NX(e,t,n){if(e===0)return"0"+(t?"s":"seconds");if(e==null)return"?";const r=Math.floor(e/86400),i=Math.floor(e%86400/3600),l=Math.floor(e%86400%3600/60),m=Math.floor(e%86400%3600%60),a=r>0?r+(t?"d":"days"):"",o=i>0?i+(t?"h":"hours"):"",u=l>0?l+(t?"m":"minutes"):"",h=m>0?m+(t?"s":"seconds"):"",c=[];return n!=null&&n.days&&c.push(a),n!=null&&n.hours&&c.push(o),n!=null&&n.minutes&&c.push(u),n!=null&&n.seconds&&c.push(h),c.join(" ")}const jX={class:"form"},VX={key:0,style:{"padding-bottom":"50px"}},UX=ae("h1",{style:{margin:"0"}},"Interrogation",-1),HX=ae("div",null,"Interrogate images to get their predicted descriptions.",-1),WX={class:"sidebar"},YX=ae("h3",{style:{margin:"16px 0 4px 0"}},"Multi Select",-1),XX={class:"main"},KX={class:"image center-horizontal"},GX={key:0},qX=Te({__name:"GenerateView",setup(e){const n=sp(ap).smallerOrEqual("md"),r=kn(),i=$t(),l=hs(),m=en();let a=[];const o=J8(async()=>{if(a.length===0)try{a=(await(await fetch(`${m.baseURL.length===0?".":m.baseURL}/sdapi/v1/samplers`)).json()).map(v=>v.name)}catch{a=[]}return a.length===0?[]:h(a)}),u=wt({prompt:[{required:!0,message:"Please input prompt",trigger:"change"}]});function h(v){return!r.params||!r.params.sampler_name||v.indexOf(r.params.sampler_name)===-1&&(r.params.sampler_name=v[0]),v}function c(v){return"Elapsed: "+NX(v,!0,{days:!0,hours:!0,minutes:!0,seconds:!0})}function f(){r.validGeneratorTypes.includes(r.generatorType)||(i.showGeneratorBadge=!1)}function s(v){r.generatorType=v,f(),console.log(v)}function d(){l.showCropPreview=!0,l.updateCropPreview()}return f(),TX(),(v,g)=>(j(),ce(ze,null,[ue(C(H1),{"default-active":C(r).generatorType,collapse:!0,onSelect:s,mode:C(n)?"horizontal":"vertical",class:fe(C(n)?"mobile-generator-types":"generator-types"),style:Fe(C(n)?"overflow-x: auto":"")},{default:pe(()=>[ue(eu,{index:"Text2Img","icon-one":C(zk),"icon-two":C(Rl),isMobile:C(n)},null,8,["icon-one","icon-two","isMobile"]),ue(eu,{index:"Img2Img","icon-one":C(Rl),"icon-two":C(Rl),isMobile:C(n)},null,8,["icon-one","icon-two","isMobile"]),ue(eu,{index:"Inpainting","icon-one":Jw,"icon-two":C(Rl),isMobile:C(n)},null,8,["icon-two","isMobile"]),ue(eu,{index:"Interrogation","icon-one":UU,isMobile:C(n)},null,8,["isMobile"])]),_:1},8,["default-active","mode","class","style"]),ae("div",jX,[C(r).generatorType==="Interrogation"?(j(),ce("div",VX,[UX,HX,ue(zX)])):(j(),_e(C(Cp),{key:1,"label-position":"left","label-width":"140px",model:C(r),class:"container",rules:u,onSubmit:g[24]||(g[24]=Qe(()=>{},["prevent"]))},{default:pe(()=>[ae("div",WX,[ue(C(O$),{modelValue:C(i).activeCollapse,"onUpdate:modelValue":g[19]||(g[19]=y=>C(i).activeCollapse=y),style:{"margin-bottom":"24px"}},{default:pe(()=>[ue(C(A$),{title:"Generation Options",name:"1"},{default:pe(()=>[ue(sH),ue(oh,{label:"Negative Prompt",prop:"negativePrompt",modelValue:C(r).negativePrompt,"onUpdate:modelValue":g[0]||(g[0]=y=>C(r).negativePrompt=y),autosize:{maxRows:15},resize:"vertical",type:"textarea",placeholder:"Enter negative prompt here",info:"What to exclude from the image. Not working? Try increasing the guidance.","label-position":"top"},null,8,["modelValue"]),ue(oh,{label:"Seed",prop:"seed",modelValue:C(r).params.seed,"onUpdate:modelValue":g[2]||(g[2]=y=>C(r).params.seed=y),placeholder:"Enter seed here"},{append:pe(()=>[ue(C(Sr),{content:"Randomize!",placement:"top"},{default:pe(()=>[ue(C(ut),{icon:C(o3),onClick:g[1]||(g[1]=()=>C(r).params.seed=Math.abs(Math.random()*2**32|0))},null,8,["icon"])]),_:1})]),_:1},8,["modelValue"]),C(r).multiSelect.sampler.enabled?(j(),_e(ih,{key:0,label:"Sampler(s)",prop:"samplers",modelValue:C(r).multiSelect.sampler.selected,"onUpdate:modelValue":g[3]||(g[3]=y=>C(r).multiSelect.sampler.selected=y),options:C(o),info:"Multi-select enabled. k_heun and k_dpm_2 double generation time and kudos cost, but converge twice as fast.",multiple:""},null,8,["modelValue","options"])):(j(),_e(ih,{key:1,label:"Sampler",prop:"sampler",modelValue:C(r).params.sampler_name,"onUpdate:modelValue":g[4]||(g[4]=y=>C(r).params.sampler_name=y),options:C(o),info:"k_heun and k_dpm_2 double generation time and kudos cost, but converge twice as fast."},null,8,["modelValue","options"])),ue(Rn,{label:"Batch Size",prop:"batchSize",modelValue:C(r).params.n,"onUpdate:modelValue":g[5]||(g[5]=y=>C(r).params.n=y),min:C(r).minImages,max:C(r).maxImages},null,8,["modelValue","min","max"]),C(r).multiSelect.steps.enabled?(j(),_e(Rn,{key:2,label:"Steps(s)",prop:"multiSteps",modelValue:C(r).multiSelect.steps.selected,"onUpdate:modelValue":g[6]||(g[6]=y=>C(r).multiSelect.steps.selected=y),min:C(r).minSteps,max:C(r).maxSteps,info:"Multi-select enabled. Keep step count between 30 to 50 for optimal generation times. Coherence typically peaks between 60 and 90 steps, with a trade-off in speed.",multiple:""},null,8,["modelValue","min","max"])):(j(),_e(Rn,{key:3,label:"Steps",prop:"steps",modelValue:C(r).params.steps,"onUpdate:modelValue":g[7]||(g[7]=y=>C(r).params.steps=y),min:C(r).minSteps,max:C(r).maxSteps,info:"Keep step count between 30 to 50 for optimal generation times. Coherence typically peaks between 60 and 90 steps, with a trade-off in speed."},null,8,["modelValue","min","max"])),ue(Rn,{label:"Width",prop:"width",modelValue:C(r).params.width,"onUpdate:modelValue":g[8]||(g[8]=y=>C(r).params.width=y),min:C(r).minDimensions,max:C(r).maxDimensions,step:64,change:d},null,8,["modelValue","min","max"]),ue(Rn,{label:"Height",prop:"height",modelValue:C(r).params.height,"onUpdate:modelValue":g[9]||(g[9]=y=>C(r).params.height=y),min:C(r).minDimensions,max:C(r).maxDimensions,step:64,change:d},null,8,["modelValue","min","max"]),C(r).multiSelect.guidance.enabled?(j(),_e(Rn,{key:4,label:"Guidance(s)",prop:"cfgScales",modelValue:C(r).multiSelect.guidance.selected,"onUpdate:modelValue":g[10]||(g[10]=y=>C(r).multiSelect.guidance.selected=y),min:C(r).minCfgScale,max:C(r).maxCfgScale,info:"Multi-select enabled. Higher values will make the AI respect your prompt more. Lower values allow the AI to be more creative.",multiple:""},null,8,["modelValue","min","max"])):(j(),_e(Rn,{key:5,label:"Guidance",prop:"cfgScale",modelValue:C(r).params.cfg_scale,"onUpdate:modelValue":g[11]||(g[11]=y=>C(r).params.cfg_scale=y),min:C(r).minCfgScale,max:C(r).maxCfgScale,step:.5,info:"Higher values will make the AI respect your prompt more. Lower values allow the AI to be more creative."},null,8,["modelValue","min","max","step"])),C(r).multiSelect.clipSkip.enabled?(j(),_e(Rn,{key:6,label:"CLIP Skip(s)",prop:"clipSkips",modelValue:C(r).multiSelect.clipSkip.selected,"onUpdate:modelValue":g[12]||(g[12]=y=>C(r).multiSelect.clipSkip.selected=y),min:C(r).minClipSkip,max:C(r).maxClipSkip,info:"Multi-select enabled. Last layers of CLIP to ignore. For most situations this can be left alone.",multiple:""},null,8,["modelValue","min","max"])):(j(),_e(Rn,{key:7,label:"CLIP Skip",prop:"clipSkip",modelValue:C(r).params.clip_skip,"onUpdate:modelValue":g[13]||(g[13]=y=>C(r).params.clip_skip=y),min:C(r).minClipSkip,max:C(r).maxClipSkip,info:"Last layers of CLIP to ignore. For most situations this can be left alone."},null,8,["modelValue","min","max"])),C(r).sourceGeneratorTypes.includes(C(r).generatorType)?(j(),_e(Rn,{key:8,label:"Init Strength",prop:"denoise",modelValue:C(r).params.denoising_strength,"onUpdate:modelValue":g[14]||(g[14]=y=>C(r).params.denoising_strength=y),min:C(r).minDenoise,max:C(r).maxDenoise,step:.01,info:"The final image will diverge from the starting image at higher values."},null,8,["modelValue","min","max","step"])):be("",!0),YX,ue(C(fj),null,{default:pe(()=>[ue(C(jl),{span:C(n)?24:12},{default:pe(()=>[ue(Ql,{label:"Multi Sampler",prop:"multiSamplerSwitch",modelValue:C(r).multiSelect.sampler.enabled,"onUpdate:modelValue":g[15]||(g[15]=y=>C(r).multiSelect.sampler.enabled=y)},null,8,["modelValue"])]),_:1},8,["span"]),ue(C(jl),{span:C(n)?24:12},{default:pe(()=>[ue(Ql,{label:"Multi Guidance",prop:"multiGuidanceSwitch",modelValue:C(r).multiSelect.guidance.enabled,"onUpdate:modelValue":g[16]||(g[16]=y=>C(r).multiSelect.guidance.enabled=y)},null,8,["modelValue"])]),_:1},8,["span"]),ue(C(jl),{span:C(n)?24:12},{default:pe(()=>[ue(Ql,{label:"Multi CLIP Skip",prop:"multiClipSkipSwitch",modelValue:C(r).multiSelect.clipSkip.enabled,"onUpdate:modelValue":g[17]||(g[17]=y=>C(r).multiSelect.clipSkip.enabled=y)},null,8,["modelValue"])]),_:1},8,["span"]),ue(C(jl),{span:C(n)?24:12},{default:pe(()=>[ue(Ql,{label:"Multi Steps",prop:"multiStepsSwitch",modelValue:C(r).multiSelect.steps.enabled,"onUpdate:modelValue":g[18]||(g[18]=y=>C(r).multiSelect.steps.enabled=y)},null,8,["modelValue"])]),_:1},8,["span"])]),_:1})]),_:1})]),_:1},8,["modelValue"])]),ae("div",XX,[ue(C(ut),{onClick:g[20]||(g[20]=()=>C(r).resetStore()),class:"reset-btn"},{default:pe(()=>[Ye("Reset")]),_:1}),ue(C(ut),{type:"primary",class:"generate-cancel-btn",style:Fe(C(r).generating?"width: 55%;":""),onClick:g[21]||(g[21]=()=>C(r).generateImage(C(r).generatorType))},{default:pe(()=>[ae("span",null," Generate "+Pe(C(r).totalImageCount)+" image"+Pe(C(r).totalImageCount===1?"":"s"),1)]),_:1},8,["style"]),C(r).generating?(j(),_e(C(ut),{key:0,type:"danger",class:"generate-cancel-btn",style:{width:"25%"},disabled:C(r).cancelled,onClick:g[22]||(g[22]=()=>{C(r).cancelled=!0,C(r).generating=!1})},{default:pe(()=>[Ye("Cancel all")]),_:1},8,["disabled"])):be("",!0)]),ae("div",KX,[ue(C(PD),{class:"center-both generated-image"},{default:pe(()=>[!C(r).generating&&C(r).outputs.length==0?(j(),ce("div",GX,[/Inpainting/.test(C(r).generatorType)?(j(),_e(x0,{key:0})):be("",!0),/Img2Img/.test(C(r).generatorType)?(j(),_e(x0,{key:1})):be("",!0)])):be("",!0),!C(i).showGeneratedImages&&C(r).generating?(j(),_e(ZU,{key:1,generated:C(r).outputs.length,total:C(r).queue.length,elapsed:c(C(r).timer.seconds),onShowGenerated:g[23]||(g[23]=y=>C(i).showGeneratedImages=!0)},null,8,["generated","total","elapsed"])):be("",!0),C(i).showGeneratedImages&&C(r).outputs.length!==0?(j(),_e(mH,{key:2})):be("",!0)]),_:1})])]),_:1},8,["model","rules"]))])],64))}});const ys=kT({history:Ux("./"),routes:[{path:"/",name:"generate",component:qX},{path:"/images",name:"images",component:()=>Ef(()=>Promise.resolve().then(()=>UK),void 0,import.meta.url)},{path:"/about",name:"about",component:()=>Ef(()=>Promise.resolve().then(()=>nG),void 0,import.meta.url)},{path:"/options",name:"options",component:()=>Ef(()=>Promise.resolve().then(()=>cG),void 0,import.meta.url)},{path:"/return",name:"return",redirect:e=>(window.location.href=window.location.pathname.endsWith("/")?"..":".","/")}]});function Uf(){return{steps:30,n:1,sampler_name:"Euler",width:512,height:512,cfg_scale:7,clip_skip:0,seed:-1,denoising_strength:.1}}const kn=ya("generator",()=>{const e=["Text2Img","Img2Img","Inpainting"],t=["Img2Img","Inpainting"],n=se("Text2Img"),r=se(""),i=Dn("promptHistory",[]),l=se(""),m=Dn("negativeLibrary",[]),a=se(Uf()),o=se({interval:0,seconds:0}),u=se({sampler:{name:"Sampler",enabled:!1,selected:["Euler"],noneMessage:"Failed to generate: No sampler selected.",mapToParam:M=>M.sampler_name},steps:{name:"Steps",enabled:!1,selected:[30],noneMessage:"Failed to generate: No steps selected.",mapToParam:M=>M.steps},guidance:{name:"CFG Scale",enabled:!1,selected:[7],noneMessage:"Failed to generate: No guidance selected.",mapToParam:M=>M.cfg_scale},clipSkip:{name:"Clip Skip",enabled:!1,selected:[1],noneMessage:"Failed to generate: No CLIP Skip selected.",mapToParam:M=>M.clip_skip}}),h=()=>({sourceProcessing:void 0,sourceImage:void 0,maskImage:void 0}),c=se({...h(),sourceProcessing:"inpainting"}),f=se({...h(),sourceProcessing:"img2img"}),s=M=>M==="Inpainting"?c.value:M==="Img2Img"?f.value:h(),d=ee(()=>s(n.value)),v=se(""),g=se(!1),y=se(!1),b=se([]),_=se([]),w=se(64),S=ee(()=>en().allowLargerParams==="Enabled"?3072:1024),x=se(1),T=se(20),O=se(1),A=ee(()=>en().allowLargerParams==="Enabled"?500:50),$=se(1),N=se(24),D=se(.1),F=se(1),E=se(0),H=se(10),re=(M,U,ie)=>Array.from({length:(U-M+1)/ie},(te,G)=>(G+M)*ie),Q=se(re(E.value,H.value,1)),le=se(re($.value,N.value,.5)),I=ee(()=>{const M=(ne,ge,we=1)=>ne*(ge.enabled?ge.selected.length:we),ie=a.value.n*de().length,te=M(ie,u.value.sampler),G=M(te,u.value.steps),he=M(G,u.value.guidance);return M(he,u.value.clipSkip),he});function z(){return a.value=Uf(),c.value=h(),f.value=h(),b.value=[],$t().showGeneratedImages=!1,!0}async function L(M){if(!e.includes(M))return[];if(r.value==="")return Z("Failed to generate: No prompt submitted.");for(const Ae of Object.values(u.value))if(Ae.enabled&&Ae.selected.length===0)return Z(Ae.noneMessage);const U=hs(),ie=$t();U.saveImages();const{sourceImage:te,maskImage:G,sourceProcessing:he}=s(M);X(r.value);const ne=[],ge=(Ae,st)=>Ae.enabled?Ae.selected:st,we=de(),ke=ge(u.value.guidance,[a.value.cfg_scale]),Ee=ge(u.value.steps,[a.value.steps]),Be=ge(u.value.clipSkip,[a.value.clip_skip]),ye=ge(u.value.sampler,[a.value.sampler_name]),Se=[await W()];for(const Ae of ke)for(const st of Ee)for(const lt of Be)for(const Ge of we){const Mt=Ge.split(" ### ");for(const qt of ye)for(let Tr=0;Tr{o.value.seconds++},1e3);!_.value.every(Ae=>Ae.gathered||Ae.failed)&&!y.value;){const Ae=_.value.filter(lt=>!lt.gathered&&!lt.failed),st=Re(Ae);for(const[lt,Ge]of Ae.slice(0,st).entries()){if(y.value)break;Ge.gathered=!0;try{const Mt=await ve(Ge.params);if(!Mt){Ge.failed=!0;continue}R([{...Mt,...Ge}])}catch(Mt){Ge.failed=!0,console.error("Error fetching image:",Mt)}}}}async function R(M){const U=yo();console.log(M);const ie=await Promise.all(M.map(async he=>{const ne=he.images[0];return{id:-1,image:`data:image/png;base64,${ne}`,prompt:he.prompt,clip_skip:he.params.clip_skip,modelName:he.models[0],seed:he.params.seed,steps:he.params.steps,sampler_name:he.params.sampler_name,cfg_scale:he.params.cfg_scale,width:he.params.width,height:he.params.height}})),te=await U.pushOutputs(ie),G=0;return b.value=[...te.map(he=>({type:"image",index:G,output:he})),...b.value].sort((he,ne)=>he.index-ne.index),b.value.length===_.value.length&&(_.value=[],g.value=!1,$t().showGeneratedImages=!0,clearInterval(o.value.interval),o.value.interval=0,o.value.seconds=0),ie}async function Z(M){const U=$t();return M&&U.raiseError(M,!1),[]}function V(M,U,ie,te){return U<=ie?U:($t().raiseWarning(`This image was generated using the 'Larger Values' option. Setting '${M}' to its default value instead of ${U}.`,!0),te)}function P(M,U=!0){const ie=Uf();if(n.value="Text2Img",u.value.guidance.enabled=!1,u.value.sampler.enabled=!1,ys.push("/"),U&&(M.width=M.width||ie.width,M.height=M.height||ie.height),M.prompt){const te=M.prompt.split(" ### ");r.value=te[0],l.value=te[1]||""}M.sampler_name&&(a.value.sampler_name=M.sampler_name),M.steps&&(a.value.steps=V("steps",M.steps,A.value,ie.steps)),M.cfg_scale&&(a.value.cfg_scale=M.cfg_scale),M.width&&(a.value.width=V("width",M.width,S.value,ie.width)),M.height&&(a.value.height=V("height",M.height,S.value,ie.height)),M.seed&&(a.value.seed=M.seed),M.clip_skip&&(a.value.clip_skip=V("clip_skip",M.clip_skip,H.value,ie.clip_skip))}function q(M){const U=hs();n.value="Img2Img",f.value.sourceImage=M,U.drawing=!1,b.value=[],ys.push("/"),Kn.fabric.Image.fromURL(M,U.newImage)}function J(M){const U=hs();b.value=[],c.value.sourceImage=M,n.value="Inpainting",ys.push("/"),Kn.fabric.Image.fromURL(M,U.newImage)}function oe(){return l.value===""?r.value:`${r.value} ### ${l.value}`}function de(){const M=oe(),U=M.match(/\{(.*?)\}/g)||[];if(U.length===0)return[M];let ie=[];return U.forEach(te=>{const G=[],he=te.replace("{","").replace("}","").split("|");ie.length===0?he.forEach(ne=>{const ge=M.replace(te,ne);G.push(ge)}):ie.forEach(ne=>{he.forEach(ge=>{const we=ne.replace(te,ge);G.push(we)})}),ie=[...G]}),ie}async function ve(M){const U=en();try{const ie=await fetch(`${U.baseURL.length===0?".":U.baseURL}/sdapi/v1/${M.init_images.length>0?"img":"txt"}2img`,{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify(M)}),te=await ie.json();return gh(ie,te,200,"Failed to fetch",me)?te:!1}catch{return!1}}function me(M){return $t().raiseError(M,!1),y.value=!1,b.value=[],!1}async function W(){const M=en(),U=await fetch(`${M.baseURL.length===0?".":M.baseURL}/sdapi/v1/sd-models`),ie=await U.json();if(!!gh(U,ie,200,"Failed to get available models"))return ie.length===0?"(No model loaded)":ie[0].model_name}function K(M){m.value.indexOf(M)===-1&&(m.value=[...m.value,M])}function k(M){m.value=m.value.filter(U=>U!=M)}function X(M){if(i.value.findIndex(U=>U.prompt===M)===-1){if(i.value.length>=10+i.value.filter(U=>U.starred).length){const U=i.value.filter(te=>!te.starred),ie=i.value.findIndex(te=>te===U[U.length-1]);i.value.splice(ie,1)}i.value=[...i.value,{starred:!1,timestamp:Date.now(),prompt:M}]}}function Y(M){i.value=i.value.filter(U=>U.prompt!=M&&U!=M)}function B(){return!1}return{generatorType:n,prompt:r,params:a,outputs:b,inpainting:c,img2img:f,uploadDimensions:v,cancelled:y,multiSelect:u,negativePrompt:l,generating:g,negativePromptLibrary:m,minDimensions:w,maxDimensions:S,minImages:x,maxImages:T,minSteps:O,maxSteps:A,minCfgScale:$,maxCfgScale:N,minDenoise:D,maxDenoise:F,minClipSkip:E,maxClipSkip:H,clipSkipList:Q,cfgList:le,queue:_,promptHistory:i,timer:o,validGeneratorTypes:e,sourceGeneratorTypes:t,currentImageProps:d,totalImageCount:I,generateImage:L,generateText2Img:P,generateImg2Img:q,generateInpainting:J,getPrompt:B,resetStore:z,pushToNegativeLibrary:K,removeFromNegativeLibrary:k,pushToPromptHistory:X,removeFromPromptHistory:Y}});"stream"in Blob.prototype||Object.defineProperty(Blob.prototype,"stream",{value(){return new Response(this).body}});var Uc=e=>new DataView(new ArrayBuffer(e)),Lo=e=>new Uint8Array(e.buffer||e),Xo=e=>new TextEncoder().encode(String(e));function ZX(e,t){if(t===void 0||t instanceof Date||(t=new Date(t)),e instanceof File)return{t:t||new Date(e.lastModified),o:e.stream()};if(e instanceof Response)return{t:t||new Date(e.headers.get("Last-Modified")||Date.now()),o:e.body};if(t===void 0)t=new Date;else if(isNaN(t))throw new Error("Invalid modification date.");if(typeof e=="string")return{t,o:Xo(e)};if(e instanceof Blob)return{t,o:e.stream()};if(e instanceof Uint8Array||e instanceof ReadableStream)return{t,o:e};if(e instanceof ArrayBuffer||ArrayBuffer.isView(e))return{t,o:Lo(e)};if(Symbol.asyncIterator in e)return{t,o:B2(e)};throw new TypeError("Unsupported input format.")}function B2(e){const t="next"in e?e:e[Symbol.asyncIterator]();return new ReadableStream({async pull(n){let r=0;for(;n.desiredSize>r;){const i=await t.next();if(!i.value){n.close();break}{const l=JX(i.value);n.enqueue(l),r+=l.byteLength}}}})}function JX(e){return typeof e=="string"?Xo(e):e instanceof Uint8Array?e:Lo(e)}function QX(e,t,n){if(t===void 0||t instanceof Uint8Array||(t=Xo(t)),e instanceof File)return{i:t||Xo(e.name),A:e.size};if(e instanceof Response){const r=e.headers.get("content-disposition"),i=r&&r.match(/;\s*filename\*?=["']?(.*?)["']?$/i),l=i&&i[1]||new URL(e.url).pathname.split("/").pop(),m=l&&decodeURIComponent(l),a=n||+e.headers.get("content-length");return{i:t||Xo(m),A:a}}if(!t||t.length===0)throw new Error("The file must have a name.");return typeof e=="string"?{i:t,A:Xo(e).length}:e instanceof Blob?{i:t,A:e.size}:e instanceof ArrayBuffer||ArrayBuffer.isView(e)?{i:t,A:e.byteLength}:{i:t,A:n}}var eK=new WebAssembly.Instance(new WebAssembly.Module(Uint8Array.from(atob("AGFzbQEAAAABCgJgAABgAn9/AXwDAwIAAQUDAQACBwkCAW0CAAFjAAEIAQAKlQECSQEDfwNAIAEhAEEAIQIDQCAAQQF2IABBAXFBoIbi7X5scyEAIAJBAWoiAkEIRw0ACyABQQJ0IAA2AgAgAUEBaiIBQYACRw0ACwtJAQF/IAFBf3MhAUGAgAQhAkGAgAQgAGohAANAIAFB/wFxIAItAABzQQJ0KAIAIAFBCHZzIQEgAkEBaiICIABJDQALIAFBf3O4Cw"),e=>e.charCodeAt(0)))),{c:tK,m:nK}=eK.exports,rK=Lo(nK).subarray(65536);function dy(e,t=0){for(const n of function*(r){for(;r.length>65536;)yield r.subarray(0,65536),r=r.subarray(65536);r.length&&(yield r)}(e))rK.set(n),t=tK(n.length,t);return t}function F2(e,t,n=0){const r=e.getSeconds()>>1|e.getMinutes()<<5|e.getHours()<<11,i=e.getDate()|e.getMonth()+1<<5|e.getFullYear()-1980<<9;t.setUint16(n,r,1),t.setUint16(n+2,i,1)}function iK(e){const t=Uc(30);return t.setUint32(0,1347093252),t.setUint32(4,335546368),F2(e.t,t,10),t.setUint16(26,e.i.length,1),Lo(t)}async function*oK(e){let{o:t}=e;if("then"in t&&(t=await t),t instanceof Uint8Array)yield t,e.u=dy(t,0),e.A=t.length;else{e.A=0;const n=t.getReader();for(;;){const{value:r,done:i}=await n.read();if(i)break;e.u=dy(r,e.u),e.A+=r.length,yield r}}}function aK(e){const t=Uc(16);return t.setUint32(0,1347094280),t.setUint32(4,e.u,1),t.setUint32(8,e.A,1),t.setUint32(12,e.A,1),Lo(t)}function sK(e,t){const n=Uc(46);return n.setUint32(0,1347092738),n.setUint32(4,352523264),n.setUint16(8,2048),F2(e.t,n,12),n.setUint32(16,e.u,1),n.setUint32(20,e.A,1),n.setUint32(24,e.A,1),n.setUint16(28,e.i.length,1),n.setUint16(40,33204,1),n.setUint32(42,t,1),Lo(n)}function lK(e){return e instanceof File||e instanceof Response?[[e],[e]]:[[e.input,e.name,e.size],[e.input,e.lastModified]]}function uK(e,t={}){const n={"Content-Type":"application/zip","Content-Disposition":"attachment"};return Number.isInteger(t.length)&&t.length>0&&(n["Content-Length"]=t.length),t.metadata&&(n["Content-Length"]=p(t.metadata)),new Response(B2(async function*(r){const i=[];let l=0,m=0;for await(const u of r)yield iK(u),yield u.i,yield*oK(u),yield aK(u),i.push(sK(u,l)),i.push(u.i),m++,l+=46+u.i.length+u.A;let a=0;for(const u of i)yield u,a+=u.length;const o=Uc(22);o.setUint32(0,1347093766),o.setUint16(8,m,1),o.setUint16(10,m,1),o.setUint32(12,a,1),o.setUint32(16,l,1),yield Lo(o)}(async function*(r){for await(const i of r){const[l,m]=lK(i);yield Object.assign(ZX(...m),QX(...l))}}(e))),{headers:n})}async function z2(e,t=!0,n){const r=en();t&&Ii({message:`Downloading ${e.length} image(s)...`,type:"info"});const i=[];for(let a=0;a]/g,"").substring(0,128).trimEnd();r.imageDownloadType==="PNG"?i.push({name:f+".png",input:await ps(u,"image/png")}):r.imageDownloadType==="JPG"?i.push({name:f+".jpg",input:await ps(u,"image/jpeg")}):i.push({name:f+".webp",input:await ps(u,"image/webp")}),i.push({name:f+".json",input:JSON.stringify(c,void 0,4)}),n&&n()}const l=await uK(i).blob(),m=document.createElement("a");m.href=URL.createObjectURL(l),m.download="stable_horde.zip",m.click()}async function cK(e,t){const n=en(),r=document.createElement("a");let i;n.imageDownloadType==="PNG"?(i=await ps(e,"image/png"),r.href=URL.createObjectURL(i),r.download=t.replace(/[/\\:*?"<>]/g,"").substring(0,128).trimEnd()+".png"):n.imageDownloadType==="JPG"?(i=await ps(e,"image/jpeg"),r.href=URL.createObjectURL(i),r.download=t.replace(/[/\\:*?"<>]/g,"").substring(0,128).trimEnd()+".jpg"):(r.href=e,r.download=t.replace(/[/\\:*?"<>]/g,"").substring(0,128).trimEnd()+".webp"),r.click(),i&&URL.revokeObjectURL(r.href)}const N2=Te({__name:"ImageActions",props:{imageData:null,onDelete:null},setup(e){const t=e,n=kn(),r=yo(),i=()=>{nw.confirm("This action will permanently delete this image. Continue?","Warning",{confirmButtonText:"OK",cancelButtonText:"Cancel",type:"warning"}).then(()=>{r.deleteOutput(t.imageData.id),t.onDelete!==void 0&&t.onDelete(t.imageData.id),Ii({type:"success",message:"Deleted Image"})})};async function l(m){const a=window.location.origin,o={prompt:m.prompt,width:m.width?m.width:void 0,height:m.height?m.height:void 0,steps:m.steps,cfg_scale:m.cfg_scale,sampler_name:m.sampler_name,model_name:m.modelName,seed:m.seed,clip_skip:m.clip_skip},u=window.location.pathname.replace("images","");let h=`${a}${u}?share=`,c="",f="";for(const[d,v]of Object.entries(o)){if(!v)continue;let g=v;typeof v=="string"?g=encodeURIComponent(v):Array.isArray(v)&&(g=JSON.stringify(v)),c+=`${f}${d}=${g}`,f="&"}h+=btoa(String.fromCharCode.apply(null,Array.from(SX(c)))),await navigator.clipboard.writeText(h),Ii({type:"success",message:"Copied shareable link to clipboard"})}return(m,a)=>(j(),ce(ze,null,[ue(C(ut),{onClick:i,type:"danger",icon:C(xc),plain:""},{default:pe(()=>[Ye("Delete")]),_:1},8,["icon"]),ue(C(ut),{onClick:a[0]||(a[0]=o=>C(cK)(e.imageData.image,`${e.imageData.seed}-${e.imageData.prompt}`)),type:"success",icon:C(As),plain:""},{default:pe(()=>[Ye("Download")]),_:1},8,["icon"]),e.imageData.starred?be("",!0):(j(),_e(C(ut),{key:0,onClick:a[1]||(a[1]=o=>C(r).toggleStarred(e.imageData.id)),type:"warning",icon:C(LO),plain:""},{default:pe(()=>[Ye("Favourite")]),_:1},8,["icon"])),e.imageData.starred?(j(),_e(C(ut),{key:1,onClick:a[2]||(a[2]=o=>C(r).toggleStarred(e.imageData.id)),type:"warning",icon:C(Gb),plain:""},{default:pe(()=>[Ye("Unfavourite")]),_:1},8,["icon"])):be("",!0),ue(C(ut),{onClick:a[3]||(a[3]=o=>C(n).generateText2Img(e.imageData)),type:"success",icon:C(rs),plain:""},{default:pe(()=>[Ye("Text2img")]),_:1},8,["icon"]),ue(C(ut),{onClick:a[4]||(a[4]=o=>C(n).generateImg2Img(e.imageData.image)),type:"success",icon:C(rs),plain:""},{default:pe(()=>[Ye("Img2img")]),_:1},8,["icon"]),ue(C(ut),{onClick:a[5]||(a[5]=o=>C(n).generateInpainting(e.imageData.image)),type:"success",icon:C(rs),plain:""},{default:pe(()=>[Ye("Inpainting")]),_:1},8,["icon"]),ue(C(ut),{onClick:a[6]||(a[6]=o=>l(e.imageData)),type:"success",icon:C(KE),plain:""},{default:pe(()=>[Ye("Copy Link")]),_:1},8,["icon"])],64))}}),fK={style:{"font-size":"18px","font-weight":"500"}},dK={style:{"font-family":"'Segoe UI', Tahoma, Geneva, Verdana, sans-serif","letter-spacing":"0.025em"}},hK=Te({__name:"ImageDialog",setup(e){const t=yo(),n=$t(),r=se();TI(r,{onSwipeEnd(a,o){o==="RIGHT"&&n.openModalToLeft(),o==="LEFT"&&n.openModalToRight()}});const i=ee({get(){return n.activeModal!==-1},set(){n.activeModal=-1}}),l=se(t.currentOutputs[0]);xe(()=>n.activeModal,async()=>{const a=t.currentOutputs.find(o=>o.id===n.activeModal);if(a)return l.value=a;l.value=await Lt.outputs.get(n.activeModal)||t.currentOutputs[0]});function m(){i.value=!1}return(a,o)=>{var u;return j(),_e(C(mB),{"model-value":C(i),width:(u=l.value)==null?void 0:u.width,class:"image-viewer",onClosed:m,"align-center":""},{default:pe(()=>{var h,c;return[ae("div",{class:"main-output-container",ref_key:"target",ref:r},[ae("div",{class:"main-output",style:Fe({backgroundImage:`url(${l.value.image||""})`,backgroundSize:"contain",backgroundRepeat:"no-repeat",backgroundPosition:"center center"})},null,4)],512),ae("div",fK,Pe(((h=l.value.prompt)==null?void 0:h.split("###")[0])||"Unkown Creation"),1),ae("div",dK,[ae("div",null,"Negative Prompt: "+Pe(((c=l.value.prompt)==null?void 0:c.split("###")[1])||"None"),1),ae("span",null,"Model: "+Pe(l.value.modelName||"Unknown")+" - ",1),ae("span",null,"Sampler: "+Pe(l.value.sampler_name||"Unknown")+" - ",1),ae("span",null,"Seed: "+Pe(l.value.seed||"Unknown")+" - ",1),ae("span",null,"Steps: "+Pe(l.value.steps||"Unknown")+" - ",1),ae("span",null,"CFG Scale: "+Pe(l.value.cfg_scale||"Unknown")+" - ",1),ae("span",null,"Clip Skip: "+Pe(l.value.clip_skip||"Unknown")+" - ",1),ae("span",null,"Dimensions: "+Pe(l.value.width||"???")+"x"+Pe(l.value.height||"???")+" - ",1)]),ae("div",null,[ue(N2,{"image-data":l.value},null,8,["image-data"])])]}),_:1},8,["model-value","width"])}}});const pK=e=>(Gr("data-v-8f4d2380"),e=e(),qr(),e),gK=pK(()=>ae("div",{style:{"font-size":"20px"}},"Stable UI",-1)),vK={class:"generator-icons"},mK=Te({__name:"App",setup(e){const n=sp(ap).smallerOrEqual("md"),r=$t();en();const i=OT(),l=se();return xe(()=>i.path,m=>{l.value&&l.value.open(m)}),(m,a)=>(j(),ce(ze,null,[ae("div",{class:fe({"menu-container":!C(n)})},[ue(C(H1),{"default-active":C(i).path,mode:"horizontal",router:!0,ellipsis:!C(n),class:fe(C(n)?"mobile-menu":"menu"),ref_key:"menuRef",ref:l},{default:pe(()=>[C(n)?be("",!0):(j(),_e(C(Tp),{key:0,class:"remove-item-styling center-vertical"},{title:pe(()=>[gK]),_:1})),ue(ja,{isMobile:C(n),index:"/"},{icon:pe(()=>[ae("div",vK,[ue(C(Le),null,{default:pe(()=>[ue(C(L3))]),_:1}),C(r).showGeneratorBadge?(j(),_e(C(Le),{key:0,class:"generator-badge",size:10},{default:pe(()=>[ue(OU)]),_:1})):be("",!0)])]),title:pe(()=>[Ye("Generate")]),_:1},8,["isMobile"]),ue(ja,{isMobile:C(n),index:"/images"},{icon:pe(()=>[ue(C(Le),null,{default:pe(()=>[ue(C(f3))]),_:1})]),title:pe(()=>[Ye("Images")]),_:1},8,["isMobile"]),ue(ja,{isMobile:C(n),index:"/about"},{icon:pe(()=>[ue(C(Le),null,{default:pe(()=>[ue(C(Wb))]),_:1})]),title:pe(()=>[Ye("About")]),_:1},8,["isMobile"]),ue(ja,{isMobile:C(n),index:"/options"},{icon:pe(()=>[ue(C(Le),null,{default:pe(()=>[ue(C(HO))]),_:1})]),title:pe(()=>[Ye("Options")]),_:1},8,["isMobile"]),ue(ja,{isMobile:C(n),index:"/return"},{icon:pe(()=>[ue(C(Le),null,{default:pe(()=>[ue(C(jb))]),_:1})]),title:pe(()=>[Ye("Return to Lite")]),_:1},8,["isMobile"])]),_:1},8,["default-active","ellipsis","class"])],2),ae("div",{class:fe({view:!C(n)})},[ue(C(Nb))],2),ue(hK)],64))}});const yK=Yt(mK,[["__scopeId","data-v-8f4d2380"]]);const sg=yx(yK);sg.use(wx());sg.use(ys);sg.mount("#app");ys.replace("/");const bK={key:1,class:"image-action"},_K=Te({__name:"CustomImage",props:{imageData:null},setup(e){const t=e,n=$t(),r=se(null);rI(r,n.toggleMultiSelect,{modifiers:{prevent:!0}});const i=se(!1);xI(r,([{isIntersecting:m}])=>{m&&(i.value=m)},{rootMargin:"500px"});const l=ee(()=>n.selected.includes(t.imageData.id));return(m,a)=>(j(),ce("div",{class:"relative",ref_key:"containerRef",ref:r},[i.value?(j(),_e(C(Sp),{key:0,class:"thumbnail",src:e.imageData.image,onClick:a[0]||(a[0]=o=>C(n).activeModal=e.imageData.id),fit:"cover",loading:"lazy",style:Fe(`${C(l)&&"opacity: 0.5"}`)},null,8,["src","style"])):be("",!0),i.value?(j(),ce("div",bK,[e.imageData.starred?(j(),_e(C(Le),{key:0,class:"starred-icon",size:35,color:"var(--el-color-warning)"},{default:pe(()=>[ue(C(Gb))]),_:1})):be("",!0),C(n).multiSelect?(j(),ce("div",{key:1,class:"select-container",onClick:a[1]||(a[1]=o=>C(n).toggleSelection(e.imageData.id))},[ue(C(Le),{class:"select-icon",size:35,color:`rgba(255, 255, 255, ${C(l)?"1":"0.5"})`},{default:pe(()=>[C(l)?be("",!0):(j(),_e(C(sl),{key:0})),C(l)?(j(),_e(C(Ub),{key:1})):be("",!0)]),_:1},8,["color"])])):be("",!0)])):be("",!0)],512))}});const hy=Yt(_K,[["__scopeId","data-v-b9569bbd"]]);const wK={},CK={xmlns:"http://www.w3.org/2000/svg","xmlns:xlink":"http://www.w3.org/1999/xlink",viewBox:"0 0 1024 1024"},SK=ae("path",{d:"M880 112H144c-17.7 0-32 14.3-32 32v736c0 17.7 14.3 32 32 32h736c17.7 0 32-14.3 32-32V144c0-17.7-14.3-32-32-32zm-696 72h136v656H184V184zm656 656H384V384h456v456zM384 320V184h456v136H384z",fill:"currentColor"},null,-1),xK=[SK];function TK(e,t){return j(),ce("svg",CK,xK)}const kK=Yt(wK,[["render",TK]]),EK=e=>(Gr("data-v-301360a8"),e=e(),qr(),e),OK={class:"images-top-bar"},AK={class:"options"},PK=["onClick"],IK=["onClick"],MK=["onClick"],LK={key:1,class:"center-both",style:{gap:"12px"}},RK={key:2},DK=EK(()=>ae("em",{style:{"font-size":"14px"}},"(long press to select multiple images)",-1)),$K=[DK],BK={key:0},FK={key:0,style:{display:"flex",gap:"8px"}},zK={key:1,class:"images"},NK={key:1},jK=Te({__name:"ImagesView",setup(e){const{width:t}=RI(),n=yo(),r=en(),i=$t();function l(){i.selected=i.selected.filter(f=>!n.currentOutputs.map(s=>s.id).includes(f)),i.selected=[...i.selected,...n.currentOutputs.map(f=>f.id)],i.multiSelect=!0}async function m(){const f=await Lt.outputs.toCollection().primaryKeys();i.selected=f,i.multiSelect=!0}function a(){i.selected=i.selected.filter(f=>!n.currentOutputs.map(s=>s.id).includes(f)),i.selected.length===0&&(i.multiSelect=!1)}function o(){i.selected=[],i.multiSelect=!1}const u=()=>{nw.confirm(`This action will permanently delete ${i.selected.length} images. Continue?`,"Warning",{confirmButtonText:"OK",cancelButtonText:"Cancel",type:"warning"}).then(()=>{n.deleteMultipleOutputs(i.selected)})};Kv(["a","A","ArrowLeft"],i.openModalToLeft),Kv(["d","D","ArrowRight"],i.openModalToRight);async function h(){z2(i.selected)}const c=ee(()=>{let f=2;t.value>1440?f=6:t.value>1280?f=5:t.value>768?f=4:t.value>480&&(f=3);const s=[];for(let d=0;d(j(),ce(ze,null,[ae("div",OK,[ae("div",AK,[ue(C(Hl),{placement:"bottom",title:"Sort By",trigger:"click",width:200,transition:"none","hide-after":0},{reference:pe(()=>[ue(C(ut),{class:"btn-select"},{default:pe(()=>[ue(C(Le),{size:16},{default:pe(()=>[ue(C(CO))]),_:1})]),_:1})]),default:pe(()=>[(j(),ce(ze,null,Dt(["Newest","Oldest"],d=>ae("div",{key:d,onClick:()=>C(n).sortBy=d,class:fe(`el-select-dropdown__item ${C(n).sortBy===d?"selected":""}`)},Pe(d),11,PK)),64))]),_:1}),ue(C(Hl),{placement:"bottom",title:"Filter By",trigger:"click",width:240,transition:"none","hide-after":0},{reference:pe(()=>[ue(C(ut),{class:"btn-select"},{default:pe(()=>[ue(C(Le),{size:16},{default:pe(()=>[ue(C(xE))]),_:1})]),_:1})]),default:pe(()=>[(j(),ce(ze,null,Dt(["all","favourited","unfavourited","unrated"],d=>ae("div",{key:d,onClick:()=>C(n).filterBy=d,class:fe(`el-select-dropdown__item ${C(n).filterBy===d?"selected":""}`)},Pe(C(n).filterBy===d?"Showing":"Show")+" "+Pe(d),11,IK)),64))]),_:1}),ue(C(Hl),{placement:"bottom",title:"Image Layout",trigger:"click",width:240,transition:"none","hide-after":0},{reference:pe(()=>[ue(C(ut),{class:"btn-select"},{default:pe(()=>[ue(C(Le),{size:16},{default:pe(()=>[ue(kK)]),_:1})]),_:1})]),default:pe(()=>[(j(),ce(ze,null,Dt([{label:"Square Grid",value:"grid"},{label:"Dynamic Layout",value:"dynamic"}],d=>ae("div",{key:d.value,onClick:()=>C(n).currentLayout=d.value,class:fe(`el-select-dropdown__item ${C(n).currentLayout===d.value?"selected":""}`)},Pe(d.label),11,MK)),64))]),_:1}),ue(C(Hl),{placement:"bottom",title:"Selection",trigger:"click",width:240,transition:"none","hide-after":0},{reference:pe(()=>[ue(C(ut),{class:"btn-select"},{default:pe(()=>[ue(C(Le),{size:16},{default:pe(()=>[C(i).multiSelect?(j(),_e(C(Ub),{key:0})):(j(),_e(C(sl),{key:1}))]),_:1})]),_:1})]),default:pe(()=>[C(i).multiSelect?(j(),ce("div",{key:0,class:"el-select-dropdown__item selected",onClick:s[0]||(s[0]=(...d)=>C(i).toggleMultiSelect&&C(i).toggleMultiSelect(...d))},"Disable multi-select")):(j(),ce("div",{key:1,class:"el-select-dropdown__item",onClick:s[1]||(s[1]=(...d)=>C(i).toggleMultiSelect&&C(i).toggleMultiSelect(...d))},"Enable multi-select")),C(i).selected.length>0?(j(),ce("div",{key:2,class:"el-select-dropdown__item selected",onClick:o},"Deselect All")):(j(),ce("div",{key:3,class:"el-select-dropdown__item",onClick:m},"Select All")),C(i).selected.every(d=>!C(n).currentOutputs.map(v=>v.id).includes(d))?(j(),ce("div",{key:5,class:"el-select-dropdown__item",onClick:l},"Select Page")):(j(),ce("div",{key:4,class:"el-select-dropdown__item selected",onClick:a},"Deselect Page"))]),_:1})]),C(r).pageless==="Disabled"?(j(),_e(C(jN),{key:0,layout:"prev, pager, next",total:C(n).outputsLength,"page-size":C(r).pageSize,"current-page":C(n).currentPage,"onUpdate:currentPage":s[2]||(s[2]=d=>C(n).currentPage=d),"hide-on-single-page":""},null,8,["total","page-size","current-page"])):be("",!0),C(i).multiSelect?(j(),ce("div",LK,[ae("div",null,Pe(C(i).selected.length)+" selected",1),ue(C(ut),{type:"danger",onClick:u,icon:C(xc),plain:""},{default:pe(()=>[Ye("Delete")]),_:1},8,["icon"]),ue(C(ut),{type:"success",onClick:h,icon:C(As),plain:"",style:{margin:"0"}},{default:pe(()=>[Ye("Download")]),_:1},8,["icon"])])):(j(),ce("div",RK,$K))]),C(n).outputsLength!=0?(j(),ce("div",BK,[C(n).currentLayout==="dynamic"?(j(),ce("div",FK,[(j(!0),ce(ze,null,Dt(C(c),(d,v)=>(j(),ce("div",{key:v,style:{flex:"1 1 0%"}},[(j(!0),ce(ze,null,Dt(d,g=>(j(),_e(hy,{key:g.id,"image-data":g,style:{"margin-bottom":"8px"}},null,8,["image-data"]))),128))]))),128))])):be("",!0),C(n).currentLayout==="grid"?(j(),ce("div",zK,[(j(!0),ce(ze,null,Dt(C(n).currentOutputs,d=>(j(),_e(hy,{key:d.id,"image-data":d,style:{width:"200px",height:"200px"}},null,8,["image-data"]))),128))])):be("",!0)])):be("",!0),C(n).outputsLength==0?(j(),ce("div",NK,[ue(C(cF),{description:"No Images Found"})])):be("",!0)],64))}});const VK=Yt(jK,[["__scopeId","data-v-301360a8"]]),UK=Object.freeze(Object.defineProperty({__proto__:null,default:VK},Symbol.toStringTag,{value:"Module"})),HK=["href"],WK=Te({__name:"BaseLink",props:{href:null,router:{type:Boolean}},setup(e){return(t,n)=>{const r=ht("router-link");return j(),ce(ze,null,[e.router?be("",!0):(j(),ce("a",{key:0,target:"_blank",rel:"noreferrer noopener",href:e.href},[Ce(t.$slots,"default",{},void 0,!0)],8,HK)),e.router?(j(),_e(r,{key:1,to:e.href},{default:pe(()=>[Ce(t.$slots,"default",{},void 0,!0)]),_:3},8,["to"])):be("",!0)],64)}}});const YK=Yt(WK,[["__scopeId","data-v-17b53b7d"]]),Tl=e=>(Gr("data-v-f86e7d02"),e=e(),qr(),e),XK={class:"about"},KK={class:"about-content"},GK=Tl(()=>ae("h1",{style:{"margin-top":"0"}},"Stable UI",-1)),qK=Tl(()=>ae("div",null,"This tool was originally a front-end for the AI Horde and has since been converted for local generations with the A1111 API, such as in KoboldCpp.",-1)),ZK=Tl(()=>ae("br",null,null,-1)),JK=Tl(()=>ae("div",null,"If you want to help improve this tool, you can find the currently maintained source code from this modified version on https://github.com/LostRuins/stable-ui and https://github.com/henk717/stable-ui, which is based off https://github.com/ayunami2000/stable-ui, which derives from the original AI Horde version on https://github.com/aqualxx/stable-ui (Original author aqualxx#5004). Feel free to contribute!",-1)),QK=Tl(()=>ae("br",null,null,-1)),eG=Te({__name:"AboutView",setup(e){return(t,n)=>(j(),ce("div",XK,[ae("div",KK,[GK,qK,ZK,JK,QK,ae("div",null,[Ye("You can find the KoboldAI community and authors of this fork on the "),ue(YK,{href:"https://koboldai.org/discord"},{default:pe(()=>[Ye("KoboldAI Discord")]),_:1})])])]))}});const tG=Yt(eG,[["__scopeId","data-v-f86e7d02"]]),nG=Object.freeze(Object.defineProperty({__proto__:null,default:tG},Symbol.toStringTag,{value:"Module"}));const Hf=Te({__name:"FormRadio",props:{label:null,modelValue:null,prop:null,useBoolean:{type:Boolean},options:null,disabled:{type:Boolean},info:null,labelStyle:null,change:null},emits:["update:modelValue"],setup(e,{emit:t}){const n=e;function r(l){if(n.useBoolean&&l==="Enabled"?t("update:modelValue",!0):n.useBoolean&&l==="Disabled"?t("update:modelValue",!1):t("update:modelValue",l),!!n.change)return n.useBoolean&&l==="Enabled"?n.change(!0):n.useBoolean&&l==="Disabled"?n.change(!1):n.change(l)}const i=ee(()=>n.useBoolean?n.modelValue===!0?"Enabled":n.modelValue===!1?"Disabled":n.modelValue:n.modelValue);return(l,m)=>(j(),_e(C(wi),{prop:e.prop},{label:pe(()=>[ue(_l,{info:e.info,"label-style":e.labelStyle},{default:pe(()=>[Ce(l.$slots,"label",{},()=>[Ye(Pe(e.label),1)])]),_:3},8,["info","label-style"])]),default:pe(()=>[ue(C(i$),{disabled:e.disabled,"model-value":C(i),onChange:r},{default:pe(()=>[(j(!0),ce(ze,null,Dt(e.options,a=>(j(),_e(C(o$),{key:a,label:a},null,8,["label"]))),128))]),_:1},8,["disabled","model-value"]),Ce(l.$slots,"inline")]),_:3},8,["prop"]))}}),kl=e=>(Gr("data-v-1aa3949b"),e=e(),qr(),e),rG=kl(()=>ae("h1",null,"Options",-1)),iG=kl(()=>ae("h2",null,"Generation Options",-1)),oG=kl(()=>ae("h2",null,"Image Options",-1)),aG=kl(()=>ae("div",null,[Ye("Drop file here OR "),ae("em",null,"click to upload")],-1)),sG=kl(()=>ae("h2",null,"General Options",-1)),lG=Te({__name:"OptionsView",setup(e){const t=en(),n=yo(),r=[{value:"dark",label:"Dark"},{value:"light",label:"Light"},{value:"auto",label:"Auto"}],i=se([]),l=se(),m=se(!1),a=se(0);async function o(h){n.importFromZip(h),l.value.clearFiles()}async function u(){Ii({message:`Downloading ${n.outputsLength} image(s)... (this may take a while)`,type:"info"}),m.value=!0,a.value=0;const h=await Lt.outputs.toCollection().primaryKeys();await z2(h,!1,()=>{a.value++}),m.value=!1,a.value=0}return(h,c)=>(j(),ce(ze,null,[rG,ue(C(Cp),{"label-position":"top",model:C(t).options,onSubmit:c[7]||(c[7]=Qe(()=>{},["prevent"]))},{default:pe(()=>[ue(C(d9),{type:"border-card",style:{"min-height":"50vh"}},{default:pe(()=>[ue(C(mf),{label:"\u{1F5A8}\uFE0F Generation"},{default:pe(()=>[iG,ue(C(wi),{label:"Base URL"},{default:pe(()=>[ue(C(Po),{class:"apikey",prop:"baseURL",modelValue:C(t).baseURL,"onUpdate:modelValue":c[0]||(c[0]=f=>C(t).baseURL=f)},null,8,["modelValue"])]),_:1})]),_:1}),ue(C(mf),{label:"\u{1F4F7} Images"},{default:pe(()=>[oG,ue(Rn,{label:"Images Per Page",prop:"pageSize",modelValue:C(t).pageSize,"onUpdate:modelValue":c[1]||(c[1]=f=>C(t).pageSize=f),min:10,max:50,step:5,disabled:C(t).pageless==="Enabled"},null,8,["modelValue","disabled"]),ue(Hf,{label:"Pageless Format",prop:"pageless",modelValue:C(t).pageless,"onUpdate:modelValue":c[2]||(c[2]=f=>C(t).pageless=f),options:["Enabled","Disabled"]},null,8,["modelValue"]),ue(Hf,{label:"Carousel Auto Cycle",prop:"autoCarousel",modelValue:C(t).autoCarousel,"onUpdate:modelValue":c[3]||(c[3]=f=>C(t).autoCarousel=f),options:["Enabled","Disabled"]},null,8,["modelValue"]),ue(Hf,{label:"Image Download Format",prop:"downloadType",modelValue:C(t).imageDownloadType,"onUpdate:modelValue":c[4]||(c[4]=f=>C(t).imageDownloadType=f),options:["PNG","JPG","WEBP"]},null,8,["modelValue"]),ue(C(wi),{label:"Export Images (ZIP File)"},{default:pe(()=>[m.value?(j(),_e(C(ut),{key:1,icon:C(As),disabled:""},{default:pe(()=>[Ye("Downloading... ("+Pe(a.value)+" / "+Pe(C(n).outputsLength)+" image(s))",1)]),_:1},8,["icon"])):(j(),_e(C(ut),{key:0,icon:C(As),onClick:c[5]||(c[5]=f=>u())},{default:pe(()=>[Ye("Download "+Pe(C(n).outputsLength)+" image(s)",1)]),_:1},8,["icon"]))]),_:1}),ue(C(wi),{label:"Import Images (ZIP File)"},{default:pe(()=>[ue(C(Op),{drag:"",ref_key:"upload",ref:l,"auto-upload":!1,onChange:o,"file-list":i.value,limit:1,multiple:""},{default:pe(()=>[ue(C(Le),{size:100},{default:pe(()=>[ue(C(Yh))]),_:1}),aG]),_:1},8,["file-list"])]),_:1})]),_:1}),ue(C(mf),{label:"\u2699\uFE0F General"},{default:pe(()=>[sG,ue(ih,{label:"Color Scheme",prop:"colorScheme",modelValue:C(t).options.colorMode,"onUpdate:modelValue":c[6]||(c[6]=f=>C(t).options.colorMode=f),options:r},null,8,["modelValue"])]),_:1})]),_:1})]),_:1},8,["model"])],64))}});const uG=Yt(lG,[["__scopeId","data-v-1aa3949b"]]),cG=Object.freeze(Object.defineProperty({__proto__:null,default:uG},Symbol.toStringTag,{value:"Module"})); +`&&d>0?(c=0,f++,h++):!this.splitByGrapheme&&this._reSpaceAndTab.test(u.graphemeText[f])&&d>0&&(c++,f++),s[d]={line:h,offset:c},f+=u.graphemeLines[d].length,c+=u.graphemeLines[d].length;return s},styleHas:function(u,h){if(this._styleMap&&!this.isWrapping){var c=this._styleMap[h];c&&(h=c.line)}return o.Text.prototype.styleHas.call(this,u,h)},isEmptyStyles:function(u){if(!this.styles)return!0;var h=0,c=u+1,f,s,d=!1,v=this._styleMap[u],g=this._styleMap[u+1];v&&(u=v.line,h=v.offset),g&&(c=g.line,d=c===u,f=g.offset),s=typeof u>"u"?this.styles:{line:this.styles[u]};for(var y in s)for(var b in s[y])if(b>=h&&(!d||bc&&!O?(v.push(g),g=[],s=S,O=!0):s+=A,!O&&!d&&g.push(w),g=g.concat(b),x=d?0:this._measureWord([w],h,_),_++,O=!1,S>T&&(T=S);return N&&v.push(g),T+$>this.dynamicMinWidth&&(this.dynamicMinWidth=T-A+$),v},isEndOfWrapping:function(u){return!this._styleMap[u+1]||this._styleMap[u+1].line!==this._styleMap[u].line},missingNewlineOffset:function(u){return this.splitByGrapheme?this.isEndOfWrapping(u)?1:0:1},_splitTextIntoLines:function(u){for(var h=o.Text.prototype._splitTextIntoLines.call(this,u),c=this._wrapText(h.lines,this.width),f=new Array(c.length),s=0;s{const e=()=>({canvas:void 0,brush:void 0,visibleImageLayer:void 0,imageLayer:void 0,visibleDrawLayer:void 0,drawLayer:void 0,cropPreviewLayer:void 0,maskPathColor:"",maskBackgroundColor:"",imageScale:1,undoHistory:[],redoHistory:[],drawing:!1}),t=se({...e(),maskPathColor:"white",maskBackgroundColor:"black"}),n=se({...e(),maskPathColor:"black",maskBackgroundColor:"white"}),r=ee(()=>kn().generatorType==="Inpainting"),i=ee(()=>r.value?t.value:n.value),l=ee(()=>kn().currentImageProps),m=ee({get:()=>i.value.drawing&&!r.value,set:z=>i.value.drawing=z}),a=se(512),o=se(512),u=se(!1),h=se(30),c=se(!1),f=new Kn.fabric.Circle({radius:h.value,left:0,originX:"center",originY:"center",angle:0,fill:"",stroke:"red",strokeWidth:3,opacity:0}),s=se("Erase"),d=se("rgb(0, 0, 0, 1)");function v(){!i.value.canvas||i.value.canvas.renderAll()}function g(){u.value=!u.value,s.value=u.value?"Draw":"Erase"}function y(z=null){!i.value.canvas||(i.value.brush=i.value.canvas.freeDrawingBrush,i.value.brush.color=z||i.value.brush.color,i.value.brush.width=h.value)}async function b({history:z,erase:L=!1,draw:R=!1}={}){if(!z||!i.value.drawLayer||!i.value.visibleDrawLayer||!i.value.imageLayer||!i.value.visibleImageLayer||!i.value.canvas)return;z.path.selectable=!1,z.path.opacity=1,z.drawPath=await Q(z.path),z.visibleDrawPath=await Q(z.path),L?(z.visibleDrawPath.globalCompositeOperation="destination-out",z.drawPath.stroke=i.value.maskBackgroundColor):(z.visibleDrawPath.globalCompositeOperation="source-over",z.drawPath.stroke=R?d.value:i.value.maskPathColor);let Z=await Q(z.drawPath);Z=Z.scale(i.value.imageScale),Z.left=Z.left+z.drawPath.left*(i.value.imageScale-1),Z.top=Z.top+z.drawPath.top*(i.value.imageScale-1),R?(i.value.imageLayer.add(Z),i.value.visibleImageLayer.addWithUpdate(z.visibleDrawPath)):(i.value.drawLayer.add(Z),i.value.visibleDrawLayer.addWithUpdate(z.visibleDrawPath)),i.value.canvas.remove(z.path),v()}function _(){if(i.value.undoHistory.length===0)return;const z=i.value.undoHistory.pop();b({history:z,erase:!1,draw:m.value}),i.value.redoHistory.push(z)}function w(){if(i.value.redoHistory.length===0||!i.value.drawLayer||!i.value.visibleDrawLayer||!i.value.imageLayer||!i.value.visibleImageLayer||!i.value.canvas)return;const z=i.value.redoHistory.pop();i.value.undoHistory.push(z),m.value?(i.value.imageLayer.remove(z.drawPath),i.value.visibleImageLayer.remove(z.visibleDrawPath)):(i.value.drawLayer.remove(z.drawPath),i.value.visibleDrawLayer.remove(z.visibleDrawPath)),delete z.drawPath,delete z.visibleDrawPath,v()}function S(z){i.value.canvas=new Kn.fabric.Canvas(z,{isDrawingMode:!1,width:a.value,height:o.value,backgroundColor:"white"}),i.value.canvas.selection=!1,i.value.canvas.freeDrawingCursor="crosshair",y(i.value.maskPathColor),i.value.canvas.on("mouse:move",I),i.value.canvas.on("path:created",le),v()}function x(z,L,R,Z){let V=Z,P=Z;return L>R?(z.scaleToWidth(Z),V=Z*(o.value/a.value)):(z.scaleToHeight(Z),P=Z*(a.value/o.value)),{newHeight:V,newWidth:P}}function T(z){const L=kn();if(E(),z.selectable=!1,a.value=z.width,o.value=z.height,a.value>L.maxDimensions||o.value>L.maxDimensions){const{newHeight:Z,newWidth:V}=x(z,a.value,o.value,L.maxDimensions);a.value=V,o.value=Z}if(a.value{a.value>o.value?i.value.imageScale=a.value/R:i.value.imageScale=o.value/R,i.value.imageLayer=D({image:Z,layerHeight:Z.height,layerWidth:Z.width})}),z.cloneAsImage(Z=>{if(!i.value.canvas)return;if(a.value!==R||o.value!==R){const{newHeight:q,newWidth:J}=x(Z,a.value,o.value,R);a.value=J,o.value=q}i.value.canvas.setWidth(a.value),i.value.canvas.setHeight(o.value),i.value.canvas.isDrawingMode=!0,i.value.visibleDrawLayer=F(),i.value.visibleImageLayer=F({image:Z}),i.value.drawLayer=D();const V=a.value*i.value.imageScale,P=o.value*i.value.imageScale;L.params.width=V-V%64,L.params.height=P-P%64,i.value.visibleDrawLayer.set("opacity",.8),i.value.canvas.add(i.value.visibleImageLayer),i.value.canvas.add(i.value.visibleDrawLayer),i.value.canvas.add(f),c.value=!0,$(),O()})}function O(){const z=kn();if(!i.value.imageLayer||!i.value.drawLayer)return;const L=i.value.imageLayer.getCenter().left-z.params.width/2,R=z.params.width,Z=i.value.imageLayer.getCenter().top-z.params.height/2,V=z.params.height,P={format:"jpeg",quality:1,left:L,top:Z,width:R,height:V};l.value.sourceImage=i.value.imageLayer.toDataURL(P),l.value.maskImage=i.value.redoHistory.length===0||m.value?void 0:i.value.drawLayer.toDataURL(P).split(",")[1]}let A;function $(){if(!i.value.canvas)return;const z=kn();i.value.cropPreviewLayer&&(i.value.canvas.remove(i.value.cropPreviewLayer),i.value.cropPreviewLayer=void 0),c.value&&(i.value.cropPreviewLayer=F({layerWidth:z.params.width/i.value.imageScale,layerHeight:z.params.height/i.value.imageScale,fill:"rgba(100, 0, 0, 0.5)"}),i.value.canvas.centerObject(i.value.cropPreviewLayer),i.value.canvas.add(i.value.cropPreviewLayer),A&&clearTimeout(A),A=setTimeout(()=>{c.value=!1,$(),A=void 0},5e3))}function N(z,L){const R="data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAAAEAAAABCAYAAAAfFcSJAAAAAXNSR0IArs4c6QAAAA1JREFUGFdj+P///38ACfsD/QVDRcoAAAAASUVORK5CYII=";Kn.fabric.Image.fromURL(R,Z=>{Z.set({height:z,width:L});const V=Z.toDataURL({format:"png"});l.value.sourceImage=V,m.value=!0,T(Z)})}function D({image:z,layerWidth:L,layerHeight:R}={}){const Z=new Kn.fabric.Canvas(null);return Z.selection=!1,Z.backgroundColor=i.value.maskBackgroundColor,Z.setHeight(R||o.value),Z.setWidth(L||a.value),z&&Z.add(z),Z}function F({image:z,layerWidth:L,layerHeight:R,fill:Z,abosolute:V}={}){const P=z||new Kn.fabric.Rect({width:L||a.value,height:R||o.value,left:0,top:0,fill:Z||"transparent",absolutePositioned:V||!0,selectable:!1});return new Kn.fabric.Group([P],{selectable:!1,absolutePositioned:V||!0})}function E(){!i.value.canvas||(i.value.visibleImageLayer&&(i.value.canvas.remove(i.value.visibleImageLayer),i.value.visibleImageLayer=void 0),i.value.visibleDrawLayer&&(i.value.canvas.remove(i.value.visibleDrawLayer),i.value.visibleDrawLayer=void 0),i.value.imageLayer=void 0,i.value.drawLayer=void 0,i.value.redoHistory=[],i.value.undoHistory=[],i.value.canvas.isDrawingMode=!1)}function H(){if(!!i.value.canvas){if(i.value.visibleDrawLayer&&(i.value.canvas.remove(i.value.visibleDrawLayer),i.value.visibleDrawLayer=void 0),m.value){const z=kn();N(z.params.height||512,z.params.width||512)}i.value.drawLayer=void 0,i.value.redoHistory=[],i.value.undoHistory=[],i.value.visibleDrawLayer=F(),i.value.drawLayer=D(),i.value.visibleDrawLayer.set("opacity",.8),i.value.canvas.add(i.value.visibleDrawLayer)}}function re(){var L;O();const z=document.createElement("a");if(m.value){z.href="data:image/png;base64,"+((L=l.value.sourceImage)==null?void 0:L.split(",")[1]),z.download="image_drawing.png",z.click();return}z.href="data:image/png;base64,"+l.value.maskImage,z.download="image_mask.png",z.click()}async function Q(z){return new Promise((L,R)=>{try{z.clone(L)}catch(Z){R(Z)}})}async function le(z){const L={path:z.path};b({history:L,erase:u.value,draw:m.value}),i.value.redoHistory.push(L)}function I(z){if(!i.value.canvas)return;const L=i.value.canvas.getPointer(z.e);f.left=L.x,f.top=L.y,f.opacity=.8,u.value?(f.set("strokeWidth",3),f.set("fill",""),y("red")):(f.set("strokeWidth",0),m.value?(f.set("fill",d.value),y(d.value)):(f.set("fill","white"),y("white"))),f.set("radius",h.value/2),v()}return{showCropPreview:c,erasing:u,switchToolText:s,brushSize:h,drawColor:d,drawing:m,imageProps:i,updateCropPreview:$,createNewCanvas:S,downloadMask:re,resetCanvas:E,resetDrawing:H,flipErase:g,undoAction:w,redoAction:_,newImage:T,newBlankImage:N,setBrush:y,saveImages:O}});const _H={},wH={xmlns:"http://www.w3.org/2000/svg","xmlns:xlink":"http://www.w3.org/1999/xlink",viewBox:"0 0 20 20"},CH=ae("g",{fill:"none"},[ae("path",{d:"M11.197 2.44a1.5 1.5 0 0 1 2.121 0l4.243 4.242a1.5 1.5 0 0 1 0 2.121L9.364 17H14.5a.5.5 0 0 1 0 1H7.82a1.496 1.496 0 0 1-1.14-.437L2.437 13.32a1.5 1.5 0 0 1 0-2.121l8.76-8.76zm1.414.706a.5.5 0 0 0-.707 0L5.538 9.512l4.95 4.95l6.366-6.366a.5.5 0 0 0 0-.707L12.61 3.146zM9.781 15.17l-4.95-4.95l-1.687 1.687a.5.5 0 0 0 0 .707l4.243 4.243a.5.5 0 0 0 .707 0l1.687-1.687z",fill:"currentColor"})],-1),SH=[CH];function xH(e,t){return j(),ce("svg",wH,SH)}const TH=Yt(_H,[["render",xH]]);async function kH(e,t){const n=document.createElement("canvas"),r=n.getContext("2d"),i=new Image;return i.src=e,await new Promise(m=>i.onload=m),n.width=i.width,n.height=i.height,r==null||r.drawImage(i,0,0),n.toDataURL(t)}async function EH(e,t){const n=e.split(";base64,"),r=t!=null?t:n[0].split(":")[1],i=window.atob(r===n[0].split(":")[1]?n[1]:(await kH(e,r)).split(",")[1]),l=new Uint8Array(i.length);for(let m=0;m{const r=new FileReader;r.onload=()=>t(r.result),r.onerror=i=>n(i),r.readAsDataURL(e)})}const Jp=e=>(Gr("data-v-d200c279"),e=e(),qr(),e),OH=Jp(()=>ae("div",null,[Ye("Drop file here OR "),ae("em",null,"click to upload")],-1)),AH={key:0},PH=Jp(()=>ae("div",{class:"center-horizontal",style:{"margin-top":"5px"}},"OR",-1)),IH={class:"canvas-container"},MH=Jp(()=>ae("canvas",{id:"canvas"},null,-1)),LH={class:"action-buttons",style:{left:"10px",right:"unset"}},RH={class:"action-buttons"},DH=Te({__name:"CustomCanvas",setup(e){const t=kn(),n=$t(),r=hs(),i=se();async function l(a){if(!a.raw.type.includes("image")){n.raiseError("Uploaded file needs to be a image!",!1),i.value.clearFiles();return}const o=await t2(a.raw);t.currentImageProps.sourceImage=o,r.drawing=!1,Kn.fabric.Image.fromURL(o,r.newImage)}function m(){t.currentImageProps.sourceImage="",r.resetCanvas()}return Ze(()=>{r.createNewCanvas("canvas"),t.currentImageProps.sourceImage&&Kn.fabric.Image.fromURL(t.currentImageProps.sourceImage,r.newImage)}),(a,o)=>(j(),ce(ze,null,[C(t).currentImageProps.sourceImage?be("",!0):(j(),_e(C(Op),{key:0,drag:"",ref_key:"upload",ref:i,"auto-upload":!1,onChange:l,limit:1,multiple:""},{tip:pe(()=>[C(t).generatorType==="Img2Img"?(j(),ce("div",AH,[PH,ae("div",{class:"center-both",style:{cursor:"pointer","text-decoration":"underline","font-size":"1rem"},onClick:o[0]||(o[0]=u=>C(r).newBlankImage(C(t).params.height||512,C(t).params.width||512))},[ue(C(Le),{size:20,style:{"margin-right":"2px"}},{default:pe(()=>[ue(Jw)]),_:1}),Ye("draw something")])])):be("",!0)]),default:pe(()=>[ue(C(Le),{size:100},{default:pe(()=>[ue(C(Yh))]),_:1}),OH]),_:1},512)),gt(ae("div",null,[ae("div",IH,[MH,ae("div",LH,[ue(C(ut),{onClick:o[1]||(o[1]=u=>C(r).undoAction()),icon:C(Xb),plain:"",disabled:C(r).imageProps.redoHistory.length===0},null,8,["icon","disabled"]),ue(C(ut),{onClick:o[2]||(o[2]=u=>C(r).redoAction()),icon:C(Kb),plain:"",disabled:C(r).imageProps.undoHistory.length===0},null,8,["icon","disabled"])]),ae("div",RH,[ue(C(ut),{onClick:o[3]||(o[3]=u=>C(r).resetDrawing()),icon:C(yr),plain:""},null,8,["icon"]),ue(C(ut),{onClick:m,icon:C(xc),plain:""},null,8,["icon"]),ue(C(ut),{onClick:o[4]||(o[4]=u=>C(r).downloadMask()),icon:C(As),plain:""},null,8,["icon"]),ue(C(ut),{onClick:o[5]||(o[5]=u=>C(r).flipErase()),icon:C(r).erasing?C(yE):TH,plain:""},null,8,["icon"]),C(r).drawing?(j(),_e(C(Q$),{key:0,modelValue:C(r).drawColor,"onUpdate:modelValue":o[6]||(o[6]=u=>C(r).drawColor=u),"show-alpha":""},null,8,["modelValue"])):be("",!0)]),ue(C(Cp),{"label-width":"110px",style:{"margin-top":"10px"}},{default:pe(()=>[ue(Rn,{style:{"margin-bottom":"5px"},label:"Brush Size",prop:"brushSize",modelValue:C(r).brushSize,"onUpdate:modelValue":o[7]||(o[7]=u=>C(r).brushSize=u),min:10,max:100,step:10,change:C(r).setBrush},null,8,["modelValue","change"])]),_:1})])],512),[[Rt,C(t).currentImageProps.sourceImage]])],64))}});const x0=Yt(DH,[["__scopeId","data-v-d200c279"]]),$H={class:"centerIcons"},BH={class:"stackedIcons"},FH=Te({__name:"StackedIcon",props:{iconOne:null,iconTwo:null,size:null},setup(e){const t=e;return tx(n=>({"2ad037ca":e.size+"px"})),(n,r)=>(j(),ce("div",$H,[ae("div",BH,[ue(C(Le),{class:"firstIcon",size:e.size},{default:pe(()=>[(j(),_e(bt(t.iconOne)))]),_:1},8,["size"]),ue(C(Le),{class:"secondIcon",size:e.size},{default:pe(()=>[(j(),_e(bt(t.iconTwo)))]),_:1},8,["size"])])]))}});const zH=Yt(FH,[["__scopeId","data-v-74586a39"]]),NH={key:1,style:{width:"40px"}},eu=Te({__name:"GeneratorMenuItem",props:{index:null,iconOne:null,iconTwo:null,isMobile:{type:Boolean}},setup(e){const t=e;return(n,r)=>(j(),_e(C(Sr),{content:e.index,placement:e.isMobile?"bottom":"right",enterable:!1,"hide-after":100},{default:pe(()=>[ue(C(Tp),{index:e.index,style:{height:"60px",display:"flex","justify-content":"center"}},{default:pe(()=>[e.iconTwo?(j(),_e(zH,{key:0,iconOne:e.iconOne,iconTwo:e.iconTwo,size:40},null,8,["iconOne","iconTwo"])):(j(),ce("div",NH,[ue(C(Le),{style:{width:"35px"},size:40},{default:pe(()=>[(j(),_e(bt(t.iconOne)))]),_:1})]))]),_:1},8,["index"])]),_:1},8,["content","placement"]))}});/*! pako 2.1.0 https://github.com/nodeca/pako @license (MIT AND Zlib) */const jH=4,T0=0,k0=1,VH=2;function Aa(e){let t=e.length;for(;--t>=0;)e[t]=0}const UH=0,n2=1,HH=2,WH=3,YH=258,Qp=29,wl=256,qs=wl+1+Qp,ea=30,eg=19,r2=2*qs+1,no=15,Af=16,XH=7,tg=256,i2=16,o2=17,a2=18,ah=new Uint8Array([0,0,0,0,0,0,0,0,1,1,1,1,2,2,2,2,3,3,3,3,4,4,4,4,5,5,5,5,0]),Eu=new Uint8Array([0,0,0,0,1,1,2,2,3,3,4,4,5,5,6,6,7,7,8,8,9,9,10,10,11,11,12,12,13,13]),KH=new Uint8Array([0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,2,3,7]),s2=new Uint8Array([16,17,18,0,8,7,9,6,10,5,11,4,12,3,13,2,14,1,15]),GH=512,Dr=new Array((qs+2)*2);Aa(Dr);const gs=new Array(ea*2);Aa(gs);const Zs=new Array(GH);Aa(Zs);const Js=new Array(YH-WH+1);Aa(Js);const ng=new Array(Qp);Aa(ng);const ic=new Array(ea);Aa(ic);function Pf(e,t,n,r,i){this.static_tree=e,this.extra_bits=t,this.extra_base=n,this.elems=r,this.max_length=i,this.has_stree=e&&e.length}let l2,u2,c2;function If(e,t){this.dyn_tree=e,this.max_code=0,this.stat_desc=t}const f2=e=>e<256?Zs[e]:Zs[256+(e>>>7)],Qs=(e,t)=>{e.pending_buf[e.pending++]=t&255,e.pending_buf[e.pending++]=t>>>8&255},pn=(e,t,n)=>{e.bi_valid>Af-n?(e.bi_buf|=t<>Af-e.bi_valid,e.bi_valid+=n-Af):(e.bi_buf|=t<{pn(e,n[t*2],n[t*2+1])},d2=(e,t)=>{let n=0;do n|=e&1,e>>>=1,n<<=1;while(--t>0);return n>>>1},qH=e=>{e.bi_valid===16?(Qs(e,e.bi_buf),e.bi_buf=0,e.bi_valid=0):e.bi_valid>=8&&(e.pending_buf[e.pending++]=e.bi_buf&255,e.bi_buf>>=8,e.bi_valid-=8)},ZH=(e,t)=>{const n=t.dyn_tree,r=t.max_code,i=t.stat_desc.static_tree,l=t.stat_desc.has_stree,m=t.stat_desc.extra_bits,a=t.stat_desc.extra_base,o=t.stat_desc.max_length;let u,h,c,f,s,d,v=0;for(f=0;f<=no;f++)e.bl_count[f]=0;for(n[e.heap[e.heap_max]*2+1]=0,u=e.heap_max+1;uo&&(f=o,v++),n[h*2+1]=f,!(h>r)&&(e.bl_count[f]++,s=0,h>=a&&(s=m[h-a]),d=n[h*2],e.opt_len+=d*(f+s),l&&(e.static_len+=d*(i[h*2+1]+s)));if(v!==0){do{for(f=o-1;e.bl_count[f]===0;)f--;e.bl_count[f]--,e.bl_count[f+1]+=2,e.bl_count[o]--,v-=2}while(v>0);for(f=o;f!==0;f--)for(h=e.bl_count[f];h!==0;)c=e.heap[--u],!(c>r)&&(n[c*2+1]!==f&&(e.opt_len+=(f-n[c*2+1])*n[c*2],n[c*2+1]=f),h--)}},h2=(e,t,n)=>{const r=new Array(no+1);let i=0,l,m;for(l=1;l<=no;l++)i=i+n[l-1]<<1,r[l]=i;for(m=0;m<=t;m++){let a=e[m*2+1];a!==0&&(e[m*2]=d2(r[a]++,a))}},JH=()=>{let e,t,n,r,i;const l=new Array(no+1);for(n=0,r=0;r>=7;r{let t;for(t=0;t{e.bi_valid>8?Qs(e,e.bi_buf):e.bi_valid>0&&(e.pending_buf[e.pending++]=e.bi_buf),e.bi_buf=0,e.bi_valid=0},E0=(e,t,n,r)=>{const i=t*2,l=n*2;return e[i]{const r=e.heap[n];let i=n<<1;for(;i<=e.heap_len&&(i{let r,i,l=0,m,a;if(e.sym_next!==0)do r=e.pending_buf[e.sym_buf+l++]&255,r+=(e.pending_buf[e.sym_buf+l++]&255)<<8,i=e.pending_buf[e.sym_buf+l++],r===0?dr(e,i,t):(m=Js[i],dr(e,m+wl+1,t),a=ah[m],a!==0&&(i-=ng[m],pn(e,i,a)),r--,m=f2(r),dr(e,m,n),a=Eu[m],a!==0&&(r-=ic[m],pn(e,r,a)));while(l{const n=t.dyn_tree,r=t.stat_desc.static_tree,i=t.stat_desc.has_stree,l=t.stat_desc.elems;let m,a,o=-1,u;for(e.heap_len=0,e.heap_max=r2,m=0;m>1;m>=1;m--)Mf(e,n,m);u=l;do m=e.heap[1],e.heap[1]=e.heap[e.heap_len--],Mf(e,n,1),a=e.heap[1],e.heap[--e.heap_max]=m,e.heap[--e.heap_max]=a,n[u*2]=n[m*2]+n[a*2],e.depth[u]=(e.depth[m]>=e.depth[a]?e.depth[m]:e.depth[a])+1,n[m*2+1]=n[a*2+1]=u,e.heap[1]=u++,Mf(e,n,1);while(e.heap_len>=2);e.heap[--e.heap_max]=e.heap[1],ZH(e,t),h2(n,o,e.bl_count)},A0=(e,t,n)=>{let r,i=-1,l,m=t[0*2+1],a=0,o=7,u=4;for(m===0&&(o=138,u=3),t[(n+1)*2+1]=65535,r=0;r<=n;r++)l=m,m=t[(r+1)*2+1],!(++a{let r,i=-1,l,m=t[0*2+1],a=0,o=7,u=4;for(m===0&&(o=138,u=3),r=0;r<=n;r++)if(l=m,m=t[(r+1)*2+1],!(++a{let t;for(A0(e,e.dyn_ltree,e.l_desc.max_code),A0(e,e.dyn_dtree,e.d_desc.max_code),sh(e,e.bl_desc),t=eg-1;t>=3&&e.bl_tree[s2[t]*2+1]===0;t--);return e.opt_len+=3*(t+1)+5+5+4,t},eW=(e,t,n,r)=>{let i;for(pn(e,t-257,5),pn(e,n-1,5),pn(e,r-4,4),i=0;i{let t=4093624447,n;for(n=0;n<=31;n++,t>>>=1)if(t&1&&e.dyn_ltree[n*2]!==0)return T0;if(e.dyn_ltree[9*2]!==0||e.dyn_ltree[10*2]!==0||e.dyn_ltree[13*2]!==0)return k0;for(n=32;n{I0||(JH(),I0=!0),e.l_desc=new If(e.dyn_ltree,l2),e.d_desc=new If(e.dyn_dtree,u2),e.bl_desc=new If(e.bl_tree,c2),e.bi_buf=0,e.bi_valid=0,p2(e)},v2=(e,t,n,r)=>{pn(e,(UH<<1)+(r?1:0),3),g2(e),Qs(e,n),Qs(e,~n),n&&e.pending_buf.set(e.window.subarray(t,t+n),e.pending),e.pending+=n},rW=e=>{pn(e,n2<<1,3),dr(e,tg,Dr),qH(e)},iW=(e,t,n,r)=>{let i,l,m=0;e.level>0?(e.strm.data_type===VH&&(e.strm.data_type=tW(e)),sh(e,e.l_desc),sh(e,e.d_desc),m=QH(e),i=e.opt_len+3+7>>>3,l=e.static_len+3+7>>>3,l<=i&&(i=l)):i=l=n+5,n+4<=i&&t!==-1?v2(e,t,n,r):e.strategy===jH||l===i?(pn(e,(n2<<1)+(r?1:0),3),O0(e,Dr,gs)):(pn(e,(HH<<1)+(r?1:0),3),eW(e,e.l_desc.max_code+1,e.d_desc.max_code+1,m+1),O0(e,e.dyn_ltree,e.dyn_dtree)),p2(e),r&&g2(e)},oW=(e,t,n)=>(e.pending_buf[e.sym_buf+e.sym_next++]=t,e.pending_buf[e.sym_buf+e.sym_next++]=t>>8,e.pending_buf[e.sym_buf+e.sym_next++]=n,t===0?e.dyn_ltree[n*2]++:(e.matches++,t--,e.dyn_ltree[(Js[n]+wl+1)*2]++,e.dyn_dtree[f2(t)*2]++),e.sym_next===e.sym_end);var aW=nW,sW=v2,lW=iW,uW=oW,cW=rW,fW={_tr_init:aW,_tr_stored_block:sW,_tr_flush_block:lW,_tr_tally:uW,_tr_align:cW};const dW=(e,t,n,r)=>{let i=e&65535|0,l=e>>>16&65535|0,m=0;for(;n!==0;){m=n>2e3?2e3:n,n-=m;do i=i+t[r++]|0,l=l+i|0;while(--m);i%=65521,l%=65521}return i|l<<16|0};var el=dW;const hW=()=>{let e,t=[];for(var n=0;n<256;n++){e=n;for(var r=0;r<8;r++)e=e&1?3988292384^e>>>1:e>>>1;t[n]=e}return t},pW=new Uint32Array(hW()),gW=(e,t,n,r)=>{const i=pW,l=r+n;e^=-1;for(let m=r;m>>8^i[(e^t[m])&255];return e^-1};var Vt=gW,bo={2:"need dictionary",1:"stream end",0:"","-1":"file error","-2":"stream error","-3":"data error","-4":"insufficient memory","-5":"buffer error","-6":"incompatible version"},Pa={Z_NO_FLUSH:0,Z_PARTIAL_FLUSH:1,Z_SYNC_FLUSH:2,Z_FULL_FLUSH:3,Z_FINISH:4,Z_BLOCK:5,Z_TREES:6,Z_OK:0,Z_STREAM_END:1,Z_NEED_DICT:2,Z_ERRNO:-1,Z_STREAM_ERROR:-2,Z_DATA_ERROR:-3,Z_MEM_ERROR:-4,Z_BUF_ERROR:-5,Z_NO_COMPRESSION:0,Z_BEST_SPEED:1,Z_BEST_COMPRESSION:9,Z_DEFAULT_COMPRESSION:-1,Z_FILTERED:1,Z_HUFFMAN_ONLY:2,Z_RLE:3,Z_FIXED:4,Z_DEFAULT_STRATEGY:0,Z_BINARY:0,Z_TEXT:1,Z_UNKNOWN:2,Z_DEFLATED:8};const{_tr_init:vW,_tr_stored_block:lh,_tr_flush_block:mW,_tr_tally:Ci,_tr_align:yW}=fW,{Z_NO_FLUSH:Si,Z_PARTIAL_FLUSH:bW,Z_FULL_FLUSH:_W,Z_FINISH:Bn,Z_BLOCK:M0,Z_OK:Xt,Z_STREAM_END:L0,Z_STREAM_ERROR:vr,Z_DATA_ERROR:wW,Z_BUF_ERROR:Lf,Z_DEFAULT_COMPRESSION:CW,Z_FILTERED:SW,Z_HUFFMAN_ONLY:tu,Z_RLE:xW,Z_FIXED:TW,Z_DEFAULT_STRATEGY:kW,Z_UNKNOWN:EW,Z_DEFLATED:Nc}=Pa,OW=9,AW=15,PW=8,IW=29,MW=256,uh=MW+1+IW,LW=30,RW=19,DW=2*uh+1,$W=15,rt=3,yi=258,mr=yi+rt+1,BW=32,ga=42,rg=57,ch=69,fh=73,dh=91,hh=103,ro=113,Ka=666,un=1,Ia=2,_o=3,Ma=4,FW=3,io=(e,t)=>(e.msg=bo[t],t),R0=e=>e*2-(e>4?9:0),gi=e=>{let t=e.length;for(;--t>=0;)e[t]=0},zW=e=>{let t,n,r,i=e.w_size;t=e.hash_size,r=t;do n=e.head[--r],e.head[r]=n>=i?n-i:0;while(--t);t=i,r=t;do n=e.prev[--r],e.prev[r]=n>=i?n-i:0;while(--t)};let NW=(e,t,n)=>(t<{const t=e.state;let n=t.pending;n>e.avail_out&&(n=e.avail_out),n!==0&&(e.output.set(t.pending_buf.subarray(t.pending_out,t.pending_out+n),e.next_out),e.next_out+=n,t.pending_out+=n,e.total_out+=n,e.avail_out-=n,t.pending-=n,t.pending===0&&(t.pending_out=0))},On=(e,t)=>{mW(e,e.block_start>=0?e.block_start:-1,e.strstart-e.block_start,t),e.block_start=e.strstart,Sn(e.strm)},dt=(e,t)=>{e.pending_buf[e.pending++]=t},Va=(e,t)=>{e.pending_buf[e.pending++]=t>>>8&255,e.pending_buf[e.pending++]=t&255},ph=(e,t,n,r)=>{let i=e.avail_in;return i>r&&(i=r),i===0?0:(e.avail_in-=i,t.set(e.input.subarray(e.next_in,e.next_in+i),n),e.state.wrap===1?e.adler=el(e.adler,t,i,n):e.state.wrap===2&&(e.adler=Vt(e.adler,t,i,n)),e.next_in+=i,e.total_in+=i,i)},m2=(e,t)=>{let n=e.max_chain_length,r=e.strstart,i,l,m=e.prev_length,a=e.nice_match;const o=e.strstart>e.w_size-mr?e.strstart-(e.w_size-mr):0,u=e.window,h=e.w_mask,c=e.prev,f=e.strstart+yi;let s=u[r+m-1],d=u[r+m];e.prev_length>=e.good_match&&(n>>=2),a>e.lookahead&&(a=e.lookahead);do if(i=t,!(u[i+m]!==d||u[i+m-1]!==s||u[i]!==u[r]||u[++i]!==u[r+1])){r+=2,i++;do;while(u[++r]===u[++i]&&u[++r]===u[++i]&&u[++r]===u[++i]&&u[++r]===u[++i]&&u[++r]===u[++i]&&u[++r]===u[++i]&&u[++r]===u[++i]&&u[++r]===u[++i]&&rm){if(e.match_start=t,m=l,l>=a)break;s=u[r+m-1],d=u[r+m]}}while((t=c[t&h])>o&&--n!==0);return m<=e.lookahead?m:e.lookahead},va=e=>{const t=e.w_size;let n,r,i;do{if(r=e.window_size-e.lookahead-e.strstart,e.strstart>=t+(t-mr)&&(e.window.set(e.window.subarray(t,t+t-r),0),e.match_start-=t,e.strstart-=t,e.block_start-=t,e.insert>e.strstart&&(e.insert=e.strstart),zW(e),r+=t),e.strm.avail_in===0)break;if(n=ph(e.strm,e.window,e.strstart+e.lookahead,r),e.lookahead+=n,e.lookahead+e.insert>=rt)for(i=e.strstart-e.insert,e.ins_h=e.window[i],e.ins_h=xi(e,e.ins_h,e.window[i+1]);e.insert&&(e.ins_h=xi(e,e.ins_h,e.window[i+rt-1]),e.prev[i&e.w_mask]=e.head[e.ins_h],e.head[e.ins_h]=i,i++,e.insert--,!(e.lookahead+e.insert{let n=e.pending_buf_size-5>e.w_size?e.w_size:e.pending_buf_size-5,r,i,l,m=0,a=e.strm.avail_in;do{if(r=65535,l=e.bi_valid+42>>3,e.strm.avail_outi+e.strm.avail_in&&(r=i+e.strm.avail_in),r>l&&(r=l),r>8,e.pending_buf[e.pending-2]=~r,e.pending_buf[e.pending-1]=~r>>8,Sn(e.strm),i&&(i>r&&(i=r),e.strm.output.set(e.window.subarray(e.block_start,e.block_start+i),e.strm.next_out),e.strm.next_out+=i,e.strm.avail_out-=i,e.strm.total_out+=i,e.block_start+=i,r-=i),r&&(ph(e.strm,e.strm.output,e.strm.next_out,r),e.strm.next_out+=r,e.strm.avail_out-=r,e.strm.total_out+=r)}while(m===0);return a-=e.strm.avail_in,a&&(a>=e.w_size?(e.matches=2,e.window.set(e.strm.input.subarray(e.strm.next_in-e.w_size,e.strm.next_in),0),e.strstart=e.w_size,e.insert=e.strstart):(e.window_size-e.strstart<=a&&(e.strstart-=e.w_size,e.window.set(e.window.subarray(e.w_size,e.w_size+e.strstart),0),e.matches<2&&e.matches++,e.insert>e.strstart&&(e.insert=e.strstart)),e.window.set(e.strm.input.subarray(e.strm.next_in-a,e.strm.next_in),e.strstart),e.strstart+=a,e.insert+=a>e.w_size-e.insert?e.w_size-e.insert:a),e.block_start=e.strstart),e.high_waterl&&e.block_start>=e.w_size&&(e.block_start-=e.w_size,e.strstart-=e.w_size,e.window.set(e.window.subarray(e.w_size,e.w_size+e.strstart),0),e.matches<2&&e.matches++,l+=e.w_size,e.insert>e.strstart&&(e.insert=e.strstart)),l>e.strm.avail_in&&(l=e.strm.avail_in),l&&(ph(e.strm,e.window,e.strstart,l),e.strstart+=l,e.insert+=l>e.w_size-e.insert?e.w_size-e.insert:l),e.high_water>3,l=e.pending_buf_size-l>65535?65535:e.pending_buf_size-l,n=l>e.w_size?e.w_size:l,i=e.strstart-e.block_start,(i>=n||(i||t===Bn)&&t!==Si&&e.strm.avail_in===0&&i<=l)&&(r=i>l?l:i,m=t===Bn&&e.strm.avail_in===0&&r===i?1:0,lh(e,e.block_start,r,m),e.block_start+=r,Sn(e.strm)),m?_o:un)},Rf=(e,t)=>{let n,r;for(;;){if(e.lookahead=rt&&(e.ins_h=xi(e,e.ins_h,e.window[e.strstart+rt-1]),n=e.prev[e.strstart&e.w_mask]=e.head[e.ins_h],e.head[e.ins_h]=e.strstart),n!==0&&e.strstart-n<=e.w_size-mr&&(e.match_length=m2(e,n)),e.match_length>=rt)if(r=Ci(e,e.strstart-e.match_start,e.match_length-rt),e.lookahead-=e.match_length,e.match_length<=e.max_lazy_match&&e.lookahead>=rt){e.match_length--;do e.strstart++,e.ins_h=xi(e,e.ins_h,e.window[e.strstart+rt-1]),n=e.prev[e.strstart&e.w_mask]=e.head[e.ins_h],e.head[e.ins_h]=e.strstart;while(--e.match_length!==0);e.strstart++}else e.strstart+=e.match_length,e.match_length=0,e.ins_h=e.window[e.strstart],e.ins_h=xi(e,e.ins_h,e.window[e.strstart+1]);else r=Ci(e,0,e.window[e.strstart]),e.lookahead--,e.strstart++;if(r&&(On(e,!1),e.strm.avail_out===0))return un}return e.insert=e.strstart{let n,r,i;for(;;){if(e.lookahead=rt&&(e.ins_h=xi(e,e.ins_h,e.window[e.strstart+rt-1]),n=e.prev[e.strstart&e.w_mask]=e.head[e.ins_h],e.head[e.ins_h]=e.strstart),e.prev_length=e.match_length,e.prev_match=e.match_start,e.match_length=rt-1,n!==0&&e.prev_length4096)&&(e.match_length=rt-1)),e.prev_length>=rt&&e.match_length<=e.prev_length){i=e.strstart+e.lookahead-rt,r=Ci(e,e.strstart-1-e.prev_match,e.prev_length-rt),e.lookahead-=e.prev_length-1,e.prev_length-=2;do++e.strstart<=i&&(e.ins_h=xi(e,e.ins_h,e.window[e.strstart+rt-1]),n=e.prev[e.strstart&e.w_mask]=e.head[e.ins_h],e.head[e.ins_h]=e.strstart);while(--e.prev_length!==0);if(e.match_available=0,e.match_length=rt-1,e.strstart++,r&&(On(e,!1),e.strm.avail_out===0))return un}else if(e.match_available){if(r=Ci(e,0,e.window[e.strstart-1]),r&&On(e,!1),e.strstart++,e.lookahead--,e.strm.avail_out===0)return un}else e.match_available=1,e.strstart++,e.lookahead--}return e.match_available&&(r=Ci(e,0,e.window[e.strstart-1]),e.match_available=0),e.insert=e.strstart{let n,r,i,l;const m=e.window;for(;;){if(e.lookahead<=yi){if(va(e),e.lookahead<=yi&&t===Si)return un;if(e.lookahead===0)break}if(e.match_length=0,e.lookahead>=rt&&e.strstart>0&&(i=e.strstart-1,r=m[i],r===m[++i]&&r===m[++i]&&r===m[++i])){l=e.strstart+yi;do;while(r===m[++i]&&r===m[++i]&&r===m[++i]&&r===m[++i]&&r===m[++i]&&r===m[++i]&&r===m[++i]&&r===m[++i]&&ie.lookahead&&(e.match_length=e.lookahead)}if(e.match_length>=rt?(n=Ci(e,1,e.match_length-rt),e.lookahead-=e.match_length,e.strstart+=e.match_length,e.match_length=0):(n=Ci(e,0,e.window[e.strstart]),e.lookahead--,e.strstart++),n&&(On(e,!1),e.strm.avail_out===0))return un}return e.insert=0,t===Bn?(On(e,!0),e.strm.avail_out===0?_o:Ma):e.sym_next&&(On(e,!1),e.strm.avail_out===0)?un:Ia},VW=(e,t)=>{let n;for(;;){if(e.lookahead===0&&(va(e),e.lookahead===0)){if(t===Si)return un;break}if(e.match_length=0,n=Ci(e,0,e.window[e.strstart]),e.lookahead--,e.strstart++,n&&(On(e,!1),e.strm.avail_out===0))return un}return e.insert=0,t===Bn?(On(e,!0),e.strm.avail_out===0?_o:Ma):e.sym_next&&(On(e,!1),e.strm.avail_out===0)?un:Ia};function lr(e,t,n,r,i){this.good_length=e,this.max_lazy=t,this.nice_length=n,this.max_chain=r,this.func=i}const Ga=[new lr(0,0,0,0,y2),new lr(4,4,8,4,Rf),new lr(4,5,16,8,Rf),new lr(4,6,32,32,Rf),new lr(4,4,16,16,No),new lr(8,16,32,32,No),new lr(8,16,128,128,No),new lr(8,32,128,256,No),new lr(32,128,258,1024,No),new lr(32,258,258,4096,No)],UW=e=>{e.window_size=2*e.w_size,gi(e.head),e.max_lazy_match=Ga[e.level].max_lazy,e.good_match=Ga[e.level].good_length,e.nice_match=Ga[e.level].nice_length,e.max_chain_length=Ga[e.level].max_chain,e.strstart=0,e.block_start=0,e.lookahead=0,e.insert=0,e.match_length=e.prev_length=rt-1,e.match_available=0,e.ins_h=0};function HW(){this.strm=null,this.status=0,this.pending_buf=null,this.pending_buf_size=0,this.pending_out=0,this.pending=0,this.wrap=0,this.gzhead=null,this.gzindex=0,this.method=Nc,this.last_flush=-1,this.w_size=0,this.w_bits=0,this.w_mask=0,this.window=null,this.window_size=0,this.prev=null,this.head=null,this.ins_h=0,this.hash_size=0,this.hash_bits=0,this.hash_mask=0,this.hash_shift=0,this.block_start=0,this.match_length=0,this.prev_match=0,this.match_available=0,this.strstart=0,this.match_start=0,this.lookahead=0,this.prev_length=0,this.max_chain_length=0,this.max_lazy_match=0,this.level=0,this.strategy=0,this.good_match=0,this.nice_match=0,this.dyn_ltree=new Uint16Array(DW*2),this.dyn_dtree=new Uint16Array((2*LW+1)*2),this.bl_tree=new Uint16Array((2*RW+1)*2),gi(this.dyn_ltree),gi(this.dyn_dtree),gi(this.bl_tree),this.l_desc=null,this.d_desc=null,this.bl_desc=null,this.bl_count=new Uint16Array($W+1),this.heap=new Uint16Array(2*uh+1),gi(this.heap),this.heap_len=0,this.heap_max=0,this.depth=new Uint16Array(2*uh+1),gi(this.depth),this.sym_buf=0,this.lit_bufsize=0,this.sym_next=0,this.sym_end=0,this.opt_len=0,this.static_len=0,this.matches=0,this.insert=0,this.bi_buf=0,this.bi_valid=0}const Cl=e=>{if(!e)return 1;const t=e.state;return!t||t.strm!==e||t.status!==ga&&t.status!==rg&&t.status!==ch&&t.status!==fh&&t.status!==dh&&t.status!==hh&&t.status!==ro&&t.status!==Ka?1:0},b2=e=>{if(Cl(e))return io(e,vr);e.total_in=e.total_out=0,e.data_type=EW;const t=e.state;return t.pending=0,t.pending_out=0,t.wrap<0&&(t.wrap=-t.wrap),t.status=t.wrap===2?rg:t.wrap?ga:ro,e.adler=t.wrap===2?0:1,t.last_flush=-2,vW(t),Xt},_2=e=>{const t=b2(e);return t===Xt&&UW(e.state),t},WW=(e,t)=>Cl(e)||e.state.wrap!==2?vr:(e.state.gzhead=t,Xt),w2=(e,t,n,r,i,l)=>{if(!e)return vr;let m=1;if(t===CW&&(t=6),r<0?(m=0,r=-r):r>15&&(m=2,r-=16),i<1||i>OW||n!==Nc||r<8||r>15||t<0||t>9||l<0||l>TW||r===8&&m!==1)return io(e,vr);r===8&&(r=9);const a=new HW;return e.state=a,a.strm=e,a.status=ga,a.wrap=m,a.gzhead=null,a.w_bits=r,a.w_size=1<w2(e,t,Nc,AW,PW,kW),XW=(e,t)=>{if(Cl(e)||t>M0||t<0)return e?io(e,vr):vr;const n=e.state;if(!e.output||e.avail_in!==0&&!e.input||n.status===Ka&&t!==Bn)return io(e,e.avail_out===0?Lf:vr);const r=n.last_flush;if(n.last_flush=t,n.pending!==0){if(Sn(e),e.avail_out===0)return n.last_flush=-1,Xt}else if(e.avail_in===0&&R0(t)<=R0(r)&&t!==Bn)return io(e,Lf);if(n.status===Ka&&e.avail_in!==0)return io(e,Lf);if(n.status===ga&&n.wrap===0&&(n.status=ro),n.status===ga){let i=Nc+(n.w_bits-8<<4)<<8,l=-1;if(n.strategy>=tu||n.level<2?l=0:n.level<6?l=1:n.level===6?l=2:l=3,i|=l<<6,n.strstart!==0&&(i|=BW),i+=31-i%31,Va(n,i),n.strstart!==0&&(Va(n,e.adler>>>16),Va(n,e.adler&65535)),e.adler=1,n.status=ro,Sn(e),n.pending!==0)return n.last_flush=-1,Xt}if(n.status===rg){if(e.adler=0,dt(n,31),dt(n,139),dt(n,8),n.gzhead)dt(n,(n.gzhead.text?1:0)+(n.gzhead.hcrc?2:0)+(n.gzhead.extra?4:0)+(n.gzhead.name?8:0)+(n.gzhead.comment?16:0)),dt(n,n.gzhead.time&255),dt(n,n.gzhead.time>>8&255),dt(n,n.gzhead.time>>16&255),dt(n,n.gzhead.time>>24&255),dt(n,n.level===9?2:n.strategy>=tu||n.level<2?4:0),dt(n,n.gzhead.os&255),n.gzhead.extra&&n.gzhead.extra.length&&(dt(n,n.gzhead.extra.length&255),dt(n,n.gzhead.extra.length>>8&255)),n.gzhead.hcrc&&(e.adler=Vt(e.adler,n.pending_buf,n.pending,0)),n.gzindex=0,n.status=ch;else if(dt(n,0),dt(n,0),dt(n,0),dt(n,0),dt(n,0),dt(n,n.level===9?2:n.strategy>=tu||n.level<2?4:0),dt(n,FW),n.status=ro,Sn(e),n.pending!==0)return n.last_flush=-1,Xt}if(n.status===ch){if(n.gzhead.extra){let i=n.pending,l=(n.gzhead.extra.length&65535)-n.gzindex;for(;n.pending+l>n.pending_buf_size;){let a=n.pending_buf_size-n.pending;if(n.pending_buf.set(n.gzhead.extra.subarray(n.gzindex,n.gzindex+a),n.pending),n.pending=n.pending_buf_size,n.gzhead.hcrc&&n.pending>i&&(e.adler=Vt(e.adler,n.pending_buf,n.pending-i,i)),n.gzindex+=a,Sn(e),n.pending!==0)return n.last_flush=-1,Xt;i=0,l-=a}let m=new Uint8Array(n.gzhead.extra);n.pending_buf.set(m.subarray(n.gzindex,n.gzindex+l),n.pending),n.pending+=l,n.gzhead.hcrc&&n.pending>i&&(e.adler=Vt(e.adler,n.pending_buf,n.pending-i,i)),n.gzindex=0}n.status=fh}if(n.status===fh){if(n.gzhead.name){let i=n.pending,l;do{if(n.pending===n.pending_buf_size){if(n.gzhead.hcrc&&n.pending>i&&(e.adler=Vt(e.adler,n.pending_buf,n.pending-i,i)),Sn(e),n.pending!==0)return n.last_flush=-1,Xt;i=0}n.gzindexi&&(e.adler=Vt(e.adler,n.pending_buf,n.pending-i,i)),n.gzindex=0}n.status=dh}if(n.status===dh){if(n.gzhead.comment){let i=n.pending,l;do{if(n.pending===n.pending_buf_size){if(n.gzhead.hcrc&&n.pending>i&&(e.adler=Vt(e.adler,n.pending_buf,n.pending-i,i)),Sn(e),n.pending!==0)return n.last_flush=-1,Xt;i=0}n.gzindexi&&(e.adler=Vt(e.adler,n.pending_buf,n.pending-i,i))}n.status=hh}if(n.status===hh){if(n.gzhead.hcrc){if(n.pending+2>n.pending_buf_size&&(Sn(e),n.pending!==0))return n.last_flush=-1,Xt;dt(n,e.adler&255),dt(n,e.adler>>8&255),e.adler=0}if(n.status=ro,Sn(e),n.pending!==0)return n.last_flush=-1,Xt}if(e.avail_in!==0||n.lookahead!==0||t!==Si&&n.status!==Ka){let i=n.level===0?y2(n,t):n.strategy===tu?VW(n,t):n.strategy===xW?jW(n,t):Ga[n.level].func(n,t);if((i===_o||i===Ma)&&(n.status=Ka),i===un||i===_o)return e.avail_out===0&&(n.last_flush=-1),Xt;if(i===Ia&&(t===bW?yW(n):t!==M0&&(lh(n,0,0,!1),t===_W&&(gi(n.head),n.lookahead===0&&(n.strstart=0,n.block_start=0,n.insert=0))),Sn(e),e.avail_out===0))return n.last_flush=-1,Xt}return t!==Bn?Xt:n.wrap<=0?L0:(n.wrap===2?(dt(n,e.adler&255),dt(n,e.adler>>8&255),dt(n,e.adler>>16&255),dt(n,e.adler>>24&255),dt(n,e.total_in&255),dt(n,e.total_in>>8&255),dt(n,e.total_in>>16&255),dt(n,e.total_in>>24&255)):(Va(n,e.adler>>>16),Va(n,e.adler&65535)),Sn(e),n.wrap>0&&(n.wrap=-n.wrap),n.pending!==0?Xt:L0)},KW=e=>{if(Cl(e))return vr;const t=e.state.status;return e.state=null,t===ro?io(e,wW):Xt},GW=(e,t)=>{let n=t.length;if(Cl(e))return vr;const r=e.state,i=r.wrap;if(i===2||i===1&&r.status!==ga||r.lookahead)return vr;if(i===1&&(e.adler=el(e.adler,t,n,0)),r.wrap=0,n>=r.w_size){i===0&&(gi(r.head),r.strstart=0,r.block_start=0,r.insert=0);let o=new Uint8Array(r.w_size);o.set(t.subarray(n-r.w_size,n),0),t=o,n=r.w_size}const l=e.avail_in,m=e.next_in,a=e.input;for(e.avail_in=n,e.next_in=0,e.input=t,va(r);r.lookahead>=rt;){let o=r.strstart,u=r.lookahead-(rt-1);do r.ins_h=xi(r,r.ins_h,r.window[o+rt-1]),r.prev[o&r.w_mask]=r.head[r.ins_h],r.head[r.ins_h]=o,o++;while(--u);r.strstart=o,r.lookahead=rt-1,va(r)}return r.strstart+=r.lookahead,r.block_start=r.strstart,r.insert=r.lookahead,r.lookahead=0,r.match_length=r.prev_length=rt-1,r.match_available=0,e.next_in=m,e.input=a,e.avail_in=l,r.wrap=i,Xt};var qW=YW,ZW=w2,JW=_2,QW=b2,eY=WW,tY=XW,nY=KW,rY=GW,iY="pako deflate (from Nodeca project)",vs={deflateInit:qW,deflateInit2:ZW,deflateReset:JW,deflateResetKeep:QW,deflateSetHeader:eY,deflate:tY,deflateEnd:nY,deflateSetDictionary:rY,deflateInfo:iY};const oY=(e,t)=>Object.prototype.hasOwnProperty.call(e,t);var aY=function(e){const t=Array.prototype.slice.call(arguments,1);for(;t.length;){const n=t.shift();if(!!n){if(typeof n!="object")throw new TypeError(n+"must be non-object");for(const r in n)oY(n,r)&&(e[r]=n[r])}}return e},sY=e=>{let t=0;for(let r=0,i=e.length;r=252?6:e>=248?5:e>=240?4:e>=224?3:e>=192?2:1;tl[254]=tl[254]=1;var lY=e=>{if(typeof TextEncoder=="function"&&TextEncoder.prototype.encode)return new TextEncoder().encode(e);let t,n,r,i,l,m=e.length,a=0;for(i=0;i>>6,t[l++]=128|n&63):n<65536?(t[l++]=224|n>>>12,t[l++]=128|n>>>6&63,t[l++]=128|n&63):(t[l++]=240|n>>>18,t[l++]=128|n>>>12&63,t[l++]=128|n>>>6&63,t[l++]=128|n&63);return t};const uY=(e,t)=>{if(t<65534&&e.subarray&&C2)return String.fromCharCode.apply(null,e.length===t?e:e.subarray(0,t));let n="";for(let r=0;r{const n=t||e.length;if(typeof TextDecoder=="function"&&TextDecoder.prototype.decode)return new TextDecoder().decode(e.subarray(0,t));let r,i;const l=new Array(n*2);for(i=0,r=0;r4){l[i++]=65533,r+=a-1;continue}for(m&=a===2?31:a===3?15:7;a>1&&r1){l[i++]=65533;continue}m<65536?l[i++]=m:(m-=65536,l[i++]=55296|m>>10&1023,l[i++]=56320|m&1023)}return uY(l,i)},fY=(e,t)=>{t=t||e.length,t>e.length&&(t=e.length);let n=t-1;for(;n>=0&&(e[n]&192)===128;)n--;return n<0||n===0?t:n+tl[e[n]]>t?n:t},nl={string2buf:lY,buf2string:cY,utf8border:fY};function dY(){this.input=null,this.next_in=0,this.avail_in=0,this.total_in=0,this.output=null,this.next_out=0,this.avail_out=0,this.total_out=0,this.msg="",this.state=null,this.data_type=2,this.adler=0}var S2=dY;const x2=Object.prototype.toString,{Z_NO_FLUSH:hY,Z_SYNC_FLUSH:pY,Z_FULL_FLUSH:gY,Z_FINISH:vY,Z_OK:oc,Z_STREAM_END:mY,Z_DEFAULT_COMPRESSION:yY,Z_DEFAULT_STRATEGY:bY,Z_DEFLATED:_Y}=Pa;function Sl(e){this.options=jc.assign({level:yY,method:_Y,chunkSize:16384,windowBits:15,memLevel:8,strategy:bY},e||{});let t=this.options;t.raw&&t.windowBits>0?t.windowBits=-t.windowBits:t.gzip&&t.windowBits>0&&t.windowBits<16&&(t.windowBits+=16),this.err=0,this.msg="",this.ended=!1,this.chunks=[],this.strm=new S2,this.strm.avail_out=0;let n=vs.deflateInit2(this.strm,t.level,t.method,t.windowBits,t.memLevel,t.strategy);if(n!==oc)throw new Error(bo[n]);if(t.header&&vs.deflateSetHeader(this.strm,t.header),t.dictionary){let r;if(typeof t.dictionary=="string"?r=nl.string2buf(t.dictionary):x2.call(t.dictionary)==="[object ArrayBuffer]"?r=new Uint8Array(t.dictionary):r=t.dictionary,n=vs.deflateSetDictionary(this.strm,r),n!==oc)throw new Error(bo[n]);this._dict_set=!0}}Sl.prototype.push=function(e,t){const n=this.strm,r=this.options.chunkSize;let i,l;if(this.ended)return!1;for(t===~~t?l=t:l=t===!0?vY:hY,typeof e=="string"?n.input=nl.string2buf(e):x2.call(e)==="[object ArrayBuffer]"?n.input=new Uint8Array(e):n.input=e,n.next_in=0,n.avail_in=n.input.length;;){if(n.avail_out===0&&(n.output=new Uint8Array(r),n.next_out=0,n.avail_out=r),(l===pY||l===gY)&&n.avail_out<=6){this.onData(n.output.subarray(0,n.next_out)),n.avail_out=0;continue}if(i=vs.deflate(n,l),i===mY)return n.next_out>0&&this.onData(n.output.subarray(0,n.next_out)),i=vs.deflateEnd(this.strm),this.onEnd(i),this.ended=!0,i===oc;if(n.avail_out===0){this.onData(n.output);continue}if(l>0&&n.next_out>0){this.onData(n.output.subarray(0,n.next_out)),n.avail_out=0;continue}if(n.avail_in===0)break}return!0};Sl.prototype.onData=function(e){this.chunks.push(e)};Sl.prototype.onEnd=function(e){e===oc&&(this.result=jc.flattenChunks(this.chunks)),this.chunks=[],this.err=e,this.msg=this.strm.msg};function ig(e,t){const n=new Sl(t);if(n.push(e,!0),n.err)throw n.msg||bo[n.err];return n.result}function wY(e,t){return t=t||{},t.raw=!0,ig(e,t)}function CY(e,t){return t=t||{},t.gzip=!0,ig(e,t)}var SY=Sl,xY=ig,TY=wY,kY=CY,EY=Pa,OY={Deflate:SY,deflate:xY,deflateRaw:TY,gzip:kY,constants:EY};const nu=16209,AY=16191;var PY=function(t,n){let r,i,l,m,a,o,u,h,c,f,s,d,v,g,y,b,_,w,S,x,T,O,A,$;const N=t.state;r=t.next_in,A=t.input,i=r+(t.avail_in-5),l=t.next_out,$=t.output,m=l-(n-t.avail_out),a=l+(t.avail_out-257),o=N.dmax,u=N.wsize,h=N.whave,c=N.wnext,f=N.window,s=N.hold,d=N.bits,v=N.lencode,g=N.distcode,y=(1<>>24,s>>>=w,d-=w,w=_>>>16&255,w===0)$[l++]=_&65535;else if(w&16){S=_&65535,w&=15,w&&(d>>=w,d-=w),d<15&&(s+=A[r++]<>>24,s>>>=w,d-=w,w=_>>>16&255,w&16){if(x=_&65535,w&=15,do){t.msg="invalid distance too far back",N.mode=nu;break e}if(s>>>=w,d-=w,w=l-m,x>w){if(w=x-w,w>h&&N.sane){t.msg="invalid distance too far back",N.mode=nu;break e}if(T=0,O=f,c===0){if(T+=u-w,w2;)$[l++]=O[T++],$[l++]=O[T++],$[l++]=O[T++],S-=3;S&&($[l++]=O[T++],S>1&&($[l++]=O[T++]))}else{T=l-x;do $[l++]=$[T++],$[l++]=$[T++],$[l++]=$[T++],S-=3;while(S>2);S&&($[l++]=$[T++],S>1&&($[l++]=$[T++]))}}else if((w&64)===0){_=g[(_&65535)+(s&(1<>3,r-=S,d-=S<<3,s&=(1<{const o=a.bits;let u=0,h=0,c=0,f=0,s=0,d=0,v=0,g=0,y=0,b=0,_,w,S,x,T,O=null,A;const $=new Uint16Array(jo+1),N=new Uint16Array(jo+1);let D=null,F,E,H;for(u=0;u<=jo;u++)$[u]=0;for(h=0;h=1&&$[f]===0;f--);if(s>f&&(s=f),f===0)return i[l++]=1<<24|64<<16|0,i[l++]=1<<24|64<<16|0,a.bits=1,0;for(c=1;c0&&(e===B0||f!==1))return-1;for(N[1]=0,u=1;uD0||e===F0&&y>$0)return 1;for(;;){F=u-v,m[h]+1=A?(E=D[m[h]-A],H=O[m[h]-A]):(E=32+64,H=0),_=1<>v)+w]=F<<24|E<<16|H|0;while(w!==0);for(_=1<>=1;if(_!==0?(b&=_-1,b+=_):b=0,h++,--$[u]===0){if(u===f)break;u=t[n+m[h]]}if(u>s&&(b&x)!==S){for(v===0&&(v=s),T+=c,d=u-v,g=1<D0||e===F0&&y>$0)return 1;S=b&x,i[S]=s<<24|d<<16|T-l|0}}return b!==0&&(i[T+b]=u-v<<24|64<<16|0),a.bits=s,0};var ms=DY;const $Y=0,T2=1,k2=2,{Z_FINISH:z0,Z_BLOCK:BY,Z_TREES:ru,Z_OK:wo,Z_STREAM_END:FY,Z_NEED_DICT:zY,Z_STREAM_ERROR:Un,Z_DATA_ERROR:E2,Z_MEM_ERROR:O2,Z_BUF_ERROR:NY,Z_DEFLATED:N0}=Pa,Vc=16180,j0=16181,V0=16182,U0=16183,H0=16184,W0=16185,Y0=16186,X0=16187,K0=16188,G0=16189,ac=16190,Ar=16191,$f=16192,q0=16193,Bf=16194,Z0=16195,J0=16196,Q0=16197,ey=16198,iu=16199,ou=16200,ty=16201,ny=16202,ry=16203,iy=16204,oy=16205,Ff=16206,ay=16207,sy=16208,Pt=16209,A2=16210,P2=16211,jY=852,VY=592,UY=15,HY=UY,ly=e=>(e>>>24&255)+(e>>>8&65280)+((e&65280)<<8)+((e&255)<<24);function WY(){this.strm=null,this.mode=0,this.last=!1,this.wrap=0,this.havedict=!1,this.flags=0,this.dmax=0,this.check=0,this.total=0,this.head=null,this.wbits=0,this.wsize=0,this.whave=0,this.wnext=0,this.window=null,this.hold=0,this.bits=0,this.length=0,this.offset=0,this.extra=0,this.lencode=null,this.distcode=null,this.lenbits=0,this.distbits=0,this.ncode=0,this.nlen=0,this.ndist=0,this.have=0,this.next=null,this.lens=new Uint16Array(320),this.work=new Uint16Array(288),this.lendyn=null,this.distdyn=null,this.sane=0,this.back=0,this.was=0}const Mo=e=>{if(!e)return 1;const t=e.state;return!t||t.strm!==e||t.modeP2?1:0},I2=e=>{if(Mo(e))return Un;const t=e.state;return e.total_in=e.total_out=t.total=0,e.msg="",t.wrap&&(e.adler=t.wrap&1),t.mode=Vc,t.last=0,t.havedict=0,t.flags=-1,t.dmax=32768,t.head=null,t.hold=0,t.bits=0,t.lencode=t.lendyn=new Int32Array(jY),t.distcode=t.distdyn=new Int32Array(VY),t.sane=1,t.back=-1,wo},M2=e=>{if(Mo(e))return Un;const t=e.state;return t.wsize=0,t.whave=0,t.wnext=0,I2(e)},L2=(e,t)=>{let n;if(Mo(e))return Un;const r=e.state;return t<0?(n=0,t=-t):(n=(t>>4)+5,t<48&&(t&=15)),t&&(t<8||t>15)?Un:(r.window!==null&&r.wbits!==t&&(r.window=null),r.wrap=n,r.wbits=t,M2(e))},R2=(e,t)=>{if(!e)return Un;const n=new WY;e.state=n,n.strm=e,n.window=null,n.mode=Vc;const r=L2(e,t);return r!==wo&&(e.state=null),r},YY=e=>R2(e,HY);let uy=!0,zf,Nf;const XY=e=>{if(uy){zf=new Int32Array(512),Nf=new Int32Array(32);let t=0;for(;t<144;)e.lens[t++]=8;for(;t<256;)e.lens[t++]=9;for(;t<280;)e.lens[t++]=7;for(;t<288;)e.lens[t++]=8;for(ms(T2,e.lens,0,288,zf,0,e.work,{bits:9}),t=0;t<32;)e.lens[t++]=5;ms(k2,e.lens,0,32,Nf,0,e.work,{bits:5}),uy=!1}e.lencode=zf,e.lenbits=9,e.distcode=Nf,e.distbits=5},D2=(e,t,n,r)=>{let i;const l=e.state;return l.window===null&&(l.wsize=1<=l.wsize?(l.window.set(t.subarray(n-l.wsize,n),0),l.wnext=0,l.whave=l.wsize):(i=l.wsize-l.wnext,i>r&&(i=r),l.window.set(t.subarray(n-r,n-r+i),l.wnext),r-=i,r?(l.window.set(t.subarray(n-r,n),0),l.wnext=r,l.whave=l.wsize):(l.wnext+=i,l.wnext===l.wsize&&(l.wnext=0),l.whave{let n,r,i,l,m,a,o,u,h,c,f,s,d,v,g=0,y,b,_,w,S,x,T,O;const A=new Uint8Array(4);let $,N;const D=new Uint8Array([16,17,18,0,8,7,9,6,10,5,11,4,12,3,13,2,14,1,15]);if(Mo(e)||!e.output||!e.input&&e.avail_in!==0)return Un;n=e.state,n.mode===Ar&&(n.mode=$f),m=e.next_out,i=e.output,o=e.avail_out,l=e.next_in,r=e.input,a=e.avail_in,u=n.hold,h=n.bits,c=a,f=o,O=wo;e:for(;;)switch(n.mode){case Vc:if(n.wrap===0){n.mode=$f;break}for(;h<16;){if(a===0)break e;a--,u+=r[l++]<>>8&255,n.check=Vt(n.check,A,2,0),u=0,h=0,n.mode=j0;break}if(n.head&&(n.head.done=!1),!(n.wrap&1)||(((u&255)<<8)+(u>>8))%31){e.msg="incorrect header check",n.mode=Pt;break}if((u&15)!==N0){e.msg="unknown compression method",n.mode=Pt;break}if(u>>>=4,h-=4,T=(u&15)+8,n.wbits===0&&(n.wbits=T),T>15||T>n.wbits){e.msg="invalid window size",n.mode=Pt;break}n.dmax=1<>8&1),n.flags&512&&n.wrap&4&&(A[0]=u&255,A[1]=u>>>8&255,n.check=Vt(n.check,A,2,0)),u=0,h=0,n.mode=V0;case V0:for(;h<32;){if(a===0)break e;a--,u+=r[l++]<>>8&255,A[2]=u>>>16&255,A[3]=u>>>24&255,n.check=Vt(n.check,A,4,0)),u=0,h=0,n.mode=U0;case U0:for(;h<16;){if(a===0)break e;a--,u+=r[l++]<>8),n.flags&512&&n.wrap&4&&(A[0]=u&255,A[1]=u>>>8&255,n.check=Vt(n.check,A,2,0)),u=0,h=0,n.mode=H0;case H0:if(n.flags&1024){for(;h<16;){if(a===0)break e;a--,u+=r[l++]<>>8&255,n.check=Vt(n.check,A,2,0)),u=0,h=0}else n.head&&(n.head.extra=null);n.mode=W0;case W0:if(n.flags&1024&&(s=n.length,s>a&&(s=a),s&&(n.head&&(T=n.head.extra_len-n.length,n.head.extra||(n.head.extra=new Uint8Array(n.head.extra_len)),n.head.extra.set(r.subarray(l,l+s),T)),n.flags&512&&n.wrap&4&&(n.check=Vt(n.check,r,s,l)),a-=s,l+=s,n.length-=s),n.length))break e;n.length=0,n.mode=Y0;case Y0:if(n.flags&2048){if(a===0)break e;s=0;do T=r[l+s++],n.head&&T&&n.length<65536&&(n.head.name+=String.fromCharCode(T));while(T&&s>9&1,n.head.done=!0),e.adler=n.check=0,n.mode=Ar;break;case G0:for(;h<32;){if(a===0)break e;a--,u+=r[l++]<>>=h&7,h-=h&7,n.mode=Ff;break}for(;h<3;){if(a===0)break e;a--,u+=r[l++]<>>=1,h-=1,u&3){case 0:n.mode=q0;break;case 1:if(XY(n),n.mode=iu,t===ru){u>>>=2,h-=2;break e}break;case 2:n.mode=J0;break;case 3:e.msg="invalid block type",n.mode=Pt}u>>>=2,h-=2;break;case q0:for(u>>>=h&7,h-=h&7;h<32;){if(a===0)break e;a--,u+=r[l++]<>>16^65535)){e.msg="invalid stored block lengths",n.mode=Pt;break}if(n.length=u&65535,u=0,h=0,n.mode=Bf,t===ru)break e;case Bf:n.mode=Z0;case Z0:if(s=n.length,s){if(s>a&&(s=a),s>o&&(s=o),s===0)break e;i.set(r.subarray(l,l+s),m),a-=s,l+=s,o-=s,m+=s,n.length-=s;break}n.mode=Ar;break;case J0:for(;h<14;){if(a===0)break e;a--,u+=r[l++]<>>=5,h-=5,n.ndist=(u&31)+1,u>>>=5,h-=5,n.ncode=(u&15)+4,u>>>=4,h-=4,n.nlen>286||n.ndist>30){e.msg="too many length or distance symbols",n.mode=Pt;break}n.have=0,n.mode=Q0;case Q0:for(;n.have>>=3,h-=3}for(;n.have<19;)n.lens[D[n.have++]]=0;if(n.lencode=n.lendyn,n.lenbits=7,$={bits:n.lenbits},O=ms($Y,n.lens,0,19,n.lencode,0,n.work,$),n.lenbits=$.bits,O){e.msg="invalid code lengths set",n.mode=Pt;break}n.have=0,n.mode=ey;case ey:for(;n.have>>24,b=g>>>16&255,_=g&65535,!(y<=h);){if(a===0)break e;a--,u+=r[l++]<>>=y,h-=y,n.lens[n.have++]=_;else{if(_===16){for(N=y+2;h>>=y,h-=y,n.have===0){e.msg="invalid bit length repeat",n.mode=Pt;break}T=n.lens[n.have-1],s=3+(u&3),u>>>=2,h-=2}else if(_===17){for(N=y+3;h>>=y,h-=y,T=0,s=3+(u&7),u>>>=3,h-=3}else{for(N=y+7;h>>=y,h-=y,T=0,s=11+(u&127),u>>>=7,h-=7}if(n.have+s>n.nlen+n.ndist){e.msg="invalid bit length repeat",n.mode=Pt;break}for(;s--;)n.lens[n.have++]=T}}if(n.mode===Pt)break;if(n.lens[256]===0){e.msg="invalid code -- missing end-of-block",n.mode=Pt;break}if(n.lenbits=9,$={bits:n.lenbits},O=ms(T2,n.lens,0,n.nlen,n.lencode,0,n.work,$),n.lenbits=$.bits,O){e.msg="invalid literal/lengths set",n.mode=Pt;break}if(n.distbits=6,n.distcode=n.distdyn,$={bits:n.distbits},O=ms(k2,n.lens,n.nlen,n.ndist,n.distcode,0,n.work,$),n.distbits=$.bits,O){e.msg="invalid distances set",n.mode=Pt;break}if(n.mode=iu,t===ru)break e;case iu:n.mode=ou;case ou:if(a>=6&&o>=258){e.next_out=m,e.avail_out=o,e.next_in=l,e.avail_in=a,n.hold=u,n.bits=h,PY(e,f),m=e.next_out,i=e.output,o=e.avail_out,l=e.next_in,r=e.input,a=e.avail_in,u=n.hold,h=n.bits,n.mode===Ar&&(n.back=-1);break}for(n.back=0;g=n.lencode[u&(1<>>24,b=g>>>16&255,_=g&65535,!(y<=h);){if(a===0)break e;a--,u+=r[l++]<>w)],y=g>>>24,b=g>>>16&255,_=g&65535,!(w+y<=h);){if(a===0)break e;a--,u+=r[l++]<>>=w,h-=w,n.back+=w}if(u>>>=y,h-=y,n.back+=y,n.length=_,b===0){n.mode=oy;break}if(b&32){n.back=-1,n.mode=Ar;break}if(b&64){e.msg="invalid literal/length code",n.mode=Pt;break}n.extra=b&15,n.mode=ty;case ty:if(n.extra){for(N=n.extra;h>>=n.extra,h-=n.extra,n.back+=n.extra}n.was=n.length,n.mode=ny;case ny:for(;g=n.distcode[u&(1<>>24,b=g>>>16&255,_=g&65535,!(y<=h);){if(a===0)break e;a--,u+=r[l++]<>w)],y=g>>>24,b=g>>>16&255,_=g&65535,!(w+y<=h);){if(a===0)break e;a--,u+=r[l++]<>>=w,h-=w,n.back+=w}if(u>>>=y,h-=y,n.back+=y,b&64){e.msg="invalid distance code",n.mode=Pt;break}n.offset=_,n.extra=b&15,n.mode=ry;case ry:if(n.extra){for(N=n.extra;h>>=n.extra,h-=n.extra,n.back+=n.extra}if(n.offset>n.dmax){e.msg="invalid distance too far back",n.mode=Pt;break}n.mode=iy;case iy:if(o===0)break e;if(s=f-o,n.offset>s){if(s=n.offset-s,s>n.whave&&n.sane){e.msg="invalid distance too far back",n.mode=Pt;break}s>n.wnext?(s-=n.wnext,d=n.wsize-s):d=n.wnext-s,s>n.length&&(s=n.length),v=n.window}else v=i,d=m-n.offset,s=n.length;s>o&&(s=o),o-=s,n.length-=s;do i[m++]=v[d++];while(--s);n.length===0&&(n.mode=ou);break;case oy:if(o===0)break e;i[m++]=n.length,o--,n.mode=ou;break;case Ff:if(n.wrap){for(;h<32;){if(a===0)break e;a--,u|=r[l++]<{if(Mo(e))return Un;let t=e.state;return t.window&&(t.window=null),e.state=null,wo},qY=(e,t)=>{if(Mo(e))return Un;const n=e.state;return(n.wrap&2)===0?Un:(n.head=t,t.done=!1,wo)},ZY=(e,t)=>{const n=t.length;let r,i,l;return Mo(e)||(r=e.state,r.wrap!==0&&r.mode!==ac)?Un:r.mode===ac&&(i=1,i=el(i,t,n,0),i!==r.check)?E2:(l=D2(e,t,n,n),l?(r.mode=A2,O2):(r.havedict=1,wo))};var JY=M2,QY=L2,eX=I2,tX=YY,nX=R2,rX=KY,iX=GY,oX=qY,aX=ZY,sX="pako inflate (from Nodeca project)",$r={inflateReset:JY,inflateReset2:QY,inflateResetKeep:eX,inflateInit:tX,inflateInit2:nX,inflate:rX,inflateEnd:iX,inflateGetHeader:oX,inflateSetDictionary:aX,inflateInfo:sX};function lX(){this.text=0,this.time=0,this.xflags=0,this.os=0,this.extra=null,this.extra_len=0,this.name="",this.comment="",this.hcrc=0,this.done=!1}var uX=lX;const $2=Object.prototype.toString,{Z_NO_FLUSH:cX,Z_FINISH:fX,Z_OK:rl,Z_STREAM_END:jf,Z_NEED_DICT:Vf,Z_STREAM_ERROR:dX,Z_DATA_ERROR:cy,Z_MEM_ERROR:hX}=Pa;function xl(e){this.options=jc.assign({chunkSize:1024*64,windowBits:15,to:""},e||{});const t=this.options;t.raw&&t.windowBits>=0&&t.windowBits<16&&(t.windowBits=-t.windowBits,t.windowBits===0&&(t.windowBits=-15)),t.windowBits>=0&&t.windowBits<16&&!(e&&e.windowBits)&&(t.windowBits+=32),t.windowBits>15&&t.windowBits<48&&(t.windowBits&15)===0&&(t.windowBits|=15),this.err=0,this.msg="",this.ended=!1,this.chunks=[],this.strm=new S2,this.strm.avail_out=0;let n=$r.inflateInit2(this.strm,t.windowBits);if(n!==rl)throw new Error(bo[n]);if(this.header=new uX,$r.inflateGetHeader(this.strm,this.header),t.dictionary&&(typeof t.dictionary=="string"?t.dictionary=nl.string2buf(t.dictionary):$2.call(t.dictionary)==="[object ArrayBuffer]"&&(t.dictionary=new Uint8Array(t.dictionary)),t.raw&&(n=$r.inflateSetDictionary(this.strm,t.dictionary),n!==rl)))throw new Error(bo[n])}xl.prototype.push=function(e,t){const n=this.strm,r=this.options.chunkSize,i=this.options.dictionary;let l,m,a;if(this.ended)return!1;for(t===~~t?m=t:m=t===!0?fX:cX,$2.call(e)==="[object ArrayBuffer]"?n.input=new Uint8Array(e):n.input=e,n.next_in=0,n.avail_in=n.input.length;;){for(n.avail_out===0&&(n.output=new Uint8Array(r),n.next_out=0,n.avail_out=r),l=$r.inflate(n,m),l===Vf&&i&&(l=$r.inflateSetDictionary(n,i),l===rl?l=$r.inflate(n,m):l===cy&&(l=Vf));n.avail_in>0&&l===jf&&n.state.wrap>0&&e[n.next_in]!==0;)$r.inflateReset(n),l=$r.inflate(n,m);switch(l){case dX:case cy:case Vf:case hX:return this.onEnd(l),this.ended=!0,!1}if(a=n.avail_out,n.next_out&&(n.avail_out===0||l===jf))if(this.options.to==="string"){let o=nl.utf8border(n.output,n.next_out),u=n.next_out-o,h=nl.buf2string(n.output,o);n.next_out=u,n.avail_out=r-u,u&&n.output.set(n.output.subarray(o,o+u),0),this.onData(h)}else this.onData(n.output.length===n.next_out?n.output:n.output.subarray(0,n.next_out));if(!(l===rl&&a===0)){if(l===jf)return l=$r.inflateEnd(this.strm),this.onEnd(l),this.ended=!0,!0;if(n.avail_in===0)break}}return!0};xl.prototype.onData=function(e){this.chunks.push(e)};xl.prototype.onEnd=function(e){e===rl&&(this.options.to==="string"?this.result=this.chunks.join(""):this.result=jc.flattenChunks(this.chunks)),this.chunks=[],this.err=e,this.msg=this.strm.msg};function og(e,t){const n=new xl(t);if(n.push(e),n.err)throw n.msg||bo[n.err];return n.result}function pX(e,t){return t=t||{},t.raw=!0,og(e,t)}var gX=xl,vX=og,mX=pX,yX=og,bX=Pa,_X={Inflate:gX,inflate:vX,inflateRaw:mX,ungzip:yX,constants:bX};const{Deflate:dG,deflate:hG,deflateRaw:wX,gzip:pG}=OY,{Inflate:gG,inflate:vG,inflateRaw:CX,ungzip:mG}=_X;var SX=wX,xX=CX;function fy(e){const t=new Map;for(const n of e){const[r,i]=n.split("="),l=decodeURIComponent(i);t.set(r,l)}return t}const TX=function(){if(!window.location.search.includes("?"))return;const t=window.location.search.replace("?","").split("&");let n=fy(t);if(console.log("URL params:",n),n.get("share")){const l=xX(new Uint8Array(atob(n.get("share")).split("").map(m=>m.charCodeAt(0))),{to:"string"});if(!l){$t().raiseError("Error when trying to decode share parameter!",!1);return}n=fy(l.split("&")),console.log("Share URL params:",n)}const r={id:-1,image:"",prompt:n.get("prompt")||"",sampler_name:n.get("sampler_name")||"k_euler",seed:Number(n.get("seed"))||-1,steps:Number(n.get("steps")||30),cfg_scale:Number(n.get("cfg_scale")||7),height:Number(n.get("height")||512),width:Number(n.get("width")||512),clip_skip:Number(n.get("clip_skip")||0)};kn().generateText2Img(r,!1)},kX=10;function gh(e,t,n,r,i=l=>$t().raiseError(l,!1)){if(e.status===n&&t)return!0;if(!t.message)return i(`${r}: Got response code ${e.status}`);if(!t.errors)return i(`${r}: ${t.message}`);const l=Object.entries(t.errors).map(m=>`${m[0]} - ${m[1]}`).join(" | ");return i(`${r}: ${t.message} (${l})`)}const EX=ya("interrogate",()=>{const e=se({}),t=se(!1);async function n(m){$t().raiseError(m,!1),t.value=!1,e.value={}}async function r(){const m=en(),{source_image:a}=e.value;if(!a)return n("Failed to get interrogation ID: No image supplied.");t.value=!0;const o=await fetch(`${m.baseURL.length===0?".":m.baseURL}/sdapi/v1/interrogate`,{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify({image:a.split(",")[1],model:"clip"})}),u=await o.json();!gh(o,u,200,"Failed to get interrogation",n)||(e.value.id=u.id,e.value.status=u.caption)}function i(){e.value={},t.value=!1}function l(){return e.value.status||!1}return{currentInterrogation:e,interrogating:t,interrogateImage:r,getFormStatus:l,resetInterrogation:i}}),ag=e=>(Gr("data-v-db184ac6"),e=e(),qr(),e),OX={key:0,style:{"margin-top":"16px"}},AX=ag(()=>ae("div",null,[Ye("Drop file here OR "),ae("em",null,"click to upload")],-1)),PX={key:1,style:{"margin-top":"16px"}},IX={key:2},MX={style:{"margin-top":"8px"}},LX=ag(()=>ae("h2",{style:{margin:"16px 0 8px 0"}},"Interrogation Results",-1)),RX={key:0},DX=ag(()=>ae("h3",null,"Caption",-1)),$X={key:0},BX={key:1},FX=Te({__name:"InterrogationView",setup(e){const t=EX(),n=kn(),r=$t(),i=se();async function l(u){if(i.value.clearFiles(),!u.raw.type.includes("image")){r.raiseError("Uploaded file needs to be a image!",!1);return}const h=await t2(u.raw);t.currentInterrogation.source_image=h,t.interrogateImage()}function m(){n.generateText2Img({prompt:a.value})}const a=ee(()=>t.getFormStatus()),{ellipsis:o}=Qw();return(u,h)=>C(t).currentInterrogation.source_image?C(t).currentInterrogation.status?(j(),ce("div",IX,[ae("div",MX,[ue(C(ut),{icon:C(rs),onClick:C(t).resetInterrogation},{default:pe(()=>[Ye("New Interrogation")]),_:1},8,["icon","onClick"]),C(a)?(j(),_e(C(ut),{key:0,icon:C(rs),onClick:m,disabled:!C(a)},{default:pe(()=>[Ye("Text2Img (Caption)")]),_:1},8,["icon","disabled"])):be("",!0)]),LX,ue(C(Sp),{src:C(t).currentInterrogation.source_image,alt:"Uploaded Image"},null,8,["src"]),C(a)?(j(),ce("div",RX,[DX,C(a)?(j(),ce("div",BX,[ae("strong",null,Pe(C(a)),1)])):(j(),ce("div",$X,"Processing"+Pe(C(o)),1))])):be("",!0)])):(j(),ce("div",PX,[ae("strong",null,"Uploading image"+Pe(C(o)),1)])):(j(),ce("div",OX,[ae("div",null,[ue(C(Op),{onChange:l,"auto-upload":!1,limit:1,class:"interrogation-upload",ref_key:"upload",ref:i,multiple:"",drag:""},{default:pe(()=>[ue(C(Le),{size:100},{default:pe(()=>[ue(C(Yh))]),_:1}),AX]),_:1},512)])]))}});const zX=Yt(FX,[["__scopeId","data-v-db184ac6"]]);function NX(e,t,n){if(e===0)return"0"+(t?"s":"seconds");if(e==null)return"?";const r=Math.floor(e/86400),i=Math.floor(e%86400/3600),l=Math.floor(e%86400%3600/60),m=Math.floor(e%86400%3600%60),a=r>0?r+(t?"d":"days"):"",o=i>0?i+(t?"h":"hours"):"",u=l>0?l+(t?"m":"minutes"):"",h=m>0?m+(t?"s":"seconds"):"",c=[];return n!=null&&n.days&&c.push(a),n!=null&&n.hours&&c.push(o),n!=null&&n.minutes&&c.push(u),n!=null&&n.seconds&&c.push(h),c.join(" ")}const jX={class:"form"},VX={key:0,style:{"padding-bottom":"50px"}},UX=ae("h1",{style:{margin:"0"}},"Interrogation",-1),HX=ae("div",null,"Interrogate images to get their predicted descriptions.",-1),WX={class:"sidebar"},YX=ae("h3",{style:{margin:"16px 0 4px 0"}},"Multi Select",-1),XX={class:"main"},KX={class:"image center-horizontal"},GX={key:0},qX=Te({__name:"GenerateView",setup(e){const n=sp(ap).smallerOrEqual("md"),r=kn(),i=$t(),l=hs(),m=en();let a=[];const o=J8(async()=>{if(a.length===0)try{a=(await(await fetch(`${m.baseURL.length===0?".":m.baseURL}/sdapi/v1/samplers`)).json()).map(v=>v.name)}catch{a=[]}return a.length===0?[]:h(a)}),u=wt({prompt:[{required:!0,message:"Please input prompt",trigger:"change"}]});function h(v){return!r.params||!r.params.sampler_name||v.indexOf(r.params.sampler_name)===-1&&(r.params.sampler_name=v[0]),v}function c(v){return"Elapsed: "+NX(v,!0,{days:!0,hours:!0,minutes:!0,seconds:!0})}function f(){r.validGeneratorTypes.includes(r.generatorType)||(i.showGeneratorBadge=!1)}function s(v){r.generatorType=v,f(),console.log(v)}function d(){l.showCropPreview=!0,l.updateCropPreview()}return f(),TX(),(v,g)=>(j(),ce(ze,null,[ue(C(H1),{"default-active":C(r).generatorType,collapse:!0,onSelect:s,mode:C(n)?"horizontal":"vertical",class:fe(C(n)?"mobile-generator-types":"generator-types"),style:Fe(C(n)?"overflow-x: auto":"")},{default:pe(()=>[ue(eu,{index:"Text2Img","icon-one":C(zk),"icon-two":C(Rl),isMobile:C(n)},null,8,["icon-one","icon-two","isMobile"]),ue(eu,{index:"Img2Img","icon-one":C(Rl),"icon-two":C(Rl),isMobile:C(n)},null,8,["icon-one","icon-two","isMobile"]),ue(eu,{index:"Inpainting","icon-one":Jw,"icon-two":C(Rl),isMobile:C(n)},null,8,["icon-two","isMobile"]),ue(eu,{index:"Interrogation","icon-one":UU,isMobile:C(n)},null,8,["isMobile"])]),_:1},8,["default-active","mode","class","style"]),ae("div",jX,[C(r).generatorType==="Interrogation"?(j(),ce("div",VX,[UX,HX,ue(zX)])):(j(),_e(C(Cp),{key:1,"label-position":"left","label-width":"140px",model:C(r),class:"container",rules:u,onSubmit:g[24]||(g[24]=Qe(()=>{},["prevent"]))},{default:pe(()=>[ae("div",WX,[ue(C(O$),{modelValue:C(i).activeCollapse,"onUpdate:modelValue":g[19]||(g[19]=y=>C(i).activeCollapse=y),style:{"margin-bottom":"24px"}},{default:pe(()=>[ue(C(A$),{title:"Generation Options",name:"1"},{default:pe(()=>[ue(sH),ue(oh,{label:"Negative Prompt",prop:"negativePrompt",modelValue:C(r).negativePrompt,"onUpdate:modelValue":g[0]||(g[0]=y=>C(r).negativePrompt=y),autosize:{maxRows:15},resize:"vertical",type:"textarea",placeholder:"Enter negative prompt here",info:"What to exclude from the image. Not working? Try increasing the guidance.","label-position":"top"},null,8,["modelValue"]),ue(oh,{label:"Seed",prop:"seed",modelValue:C(r).params.seed,"onUpdate:modelValue":g[2]||(g[2]=y=>C(r).params.seed=y),placeholder:"Enter seed here"},{append:pe(()=>[ue(C(Sr),{content:"Randomize!",placement:"top"},{default:pe(()=>[ue(C(ut),{icon:C(o3),onClick:g[1]||(g[1]=()=>C(r).params.seed=Math.abs(Math.random()*2**32|0))},null,8,["icon"])]),_:1})]),_:1},8,["modelValue"]),C(r).multiSelect.sampler.enabled?(j(),_e(ih,{key:0,label:"Sampler(s)",prop:"samplers",modelValue:C(r).multiSelect.sampler.selected,"onUpdate:modelValue":g[3]||(g[3]=y=>C(r).multiSelect.sampler.selected=y),options:C(o),info:"Multi-select enabled. k_heun and k_dpm_2 double generation time and kudos cost, but converge twice as fast.",multiple:""},null,8,["modelValue","options"])):(j(),_e(ih,{key:1,label:"Sampler",prop:"sampler",modelValue:C(r).params.sampler_name,"onUpdate:modelValue":g[4]||(g[4]=y=>C(r).params.sampler_name=y),options:C(o),info:"k_heun and k_dpm_2 double generation time and kudos cost, but converge twice as fast."},null,8,["modelValue","options"])),ue(Rn,{label:"Batch Size",prop:"batchSize",modelValue:C(r).params.n,"onUpdate:modelValue":g[5]||(g[5]=y=>C(r).params.n=y),min:C(r).minImages,max:C(r).maxImages},null,8,["modelValue","min","max"]),C(r).multiSelect.steps.enabled?(j(),_e(Rn,{key:2,label:"Steps(s)",prop:"multiSteps",modelValue:C(r).multiSelect.steps.selected,"onUpdate:modelValue":g[6]||(g[6]=y=>C(r).multiSelect.steps.selected=y),min:C(r).minSteps,max:C(r).maxSteps,info:"Multi-select enabled. Keep step count between 30 to 50 for optimal generation times. Coherence typically peaks between 60 and 90 steps, with a trade-off in speed.",multiple:""},null,8,["modelValue","min","max"])):(j(),_e(Rn,{key:3,label:"Steps",prop:"steps",modelValue:C(r).params.steps,"onUpdate:modelValue":g[7]||(g[7]=y=>C(r).params.steps=y),min:C(r).minSteps,max:C(r).maxSteps,info:"Keep step count between 30 to 50 for optimal generation times. Coherence typically peaks between 60 and 90 steps, with a trade-off in speed."},null,8,["modelValue","min","max"])),ue(Rn,{label:"Width",prop:"width",modelValue:C(r).params.width,"onUpdate:modelValue":g[8]||(g[8]=y=>C(r).params.width=y),min:C(r).minDimensions,max:C(r).maxDimensions,step:64,change:d},null,8,["modelValue","min","max"]),ue(Rn,{label:"Height",prop:"height",modelValue:C(r).params.height,"onUpdate:modelValue":g[9]||(g[9]=y=>C(r).params.height=y),min:C(r).minDimensions,max:C(r).maxDimensions,step:64,change:d},null,8,["modelValue","min","max"]),C(r).multiSelect.guidance.enabled?(j(),_e(Rn,{key:4,label:"Guidance(s)",prop:"cfgScales",modelValue:C(r).multiSelect.guidance.selected,"onUpdate:modelValue":g[10]||(g[10]=y=>C(r).multiSelect.guidance.selected=y),min:C(r).minCfgScale,max:C(r).maxCfgScale,info:"Multi-select enabled. Higher values will make the AI respect your prompt more. Lower values allow the AI to be more creative.",multiple:""},null,8,["modelValue","min","max"])):(j(),_e(Rn,{key:5,label:"Guidance",prop:"cfgScale",modelValue:C(r).params.cfg_scale,"onUpdate:modelValue":g[11]||(g[11]=y=>C(r).params.cfg_scale=y),min:C(r).minCfgScale,max:C(r).maxCfgScale,step:.5,info:"Higher values will make the AI respect your prompt more. Lower values allow the AI to be more creative."},null,8,["modelValue","min","max","step"])),C(r).multiSelect.clipSkip.enabled?(j(),_e(Rn,{key:6,label:"CLIP Skip(s)",prop:"clipSkips",modelValue:C(r).multiSelect.clipSkip.selected,"onUpdate:modelValue":g[12]||(g[12]=y=>C(r).multiSelect.clipSkip.selected=y),min:C(r).minClipSkip,max:C(r).maxClipSkip,info:"Multi-select enabled. Last layers of CLIP to ignore. For most situations this can be left alone.",multiple:""},null,8,["modelValue","min","max"])):(j(),_e(Rn,{key:7,label:"CLIP Skip",prop:"clipSkip",modelValue:C(r).params.clip_skip,"onUpdate:modelValue":g[13]||(g[13]=y=>C(r).params.clip_skip=y),min:C(r).minClipSkip,max:C(r).maxClipSkip,info:"Last layers of CLIP to ignore. For most situations this can be left alone."},null,8,["modelValue","min","max"])),C(r).sourceGeneratorTypes.includes(C(r).generatorType)?(j(),_e(Rn,{key:8,label:"Init Strength",prop:"denoise",modelValue:C(r).params.denoising_strength,"onUpdate:modelValue":g[14]||(g[14]=y=>C(r).params.denoising_strength=y),min:C(r).minDenoise,max:C(r).maxDenoise,step:.01,info:"The final image will diverge from the starting image at higher values."},null,8,["modelValue","min","max","step"])):be("",!0),YX,ue(C(fj),null,{default:pe(()=>[ue(C(jl),{span:C(n)?24:12},{default:pe(()=>[ue(Ql,{label:"Multi Sampler",prop:"multiSamplerSwitch",modelValue:C(r).multiSelect.sampler.enabled,"onUpdate:modelValue":g[15]||(g[15]=y=>C(r).multiSelect.sampler.enabled=y)},null,8,["modelValue"])]),_:1},8,["span"]),ue(C(jl),{span:C(n)?24:12},{default:pe(()=>[ue(Ql,{label:"Multi Guidance",prop:"multiGuidanceSwitch",modelValue:C(r).multiSelect.guidance.enabled,"onUpdate:modelValue":g[16]||(g[16]=y=>C(r).multiSelect.guidance.enabled=y)},null,8,["modelValue"])]),_:1},8,["span"]),ue(C(jl),{span:C(n)?24:12},{default:pe(()=>[ue(Ql,{label:"Multi CLIP Skip",prop:"multiClipSkipSwitch",modelValue:C(r).multiSelect.clipSkip.enabled,"onUpdate:modelValue":g[17]||(g[17]=y=>C(r).multiSelect.clipSkip.enabled=y)},null,8,["modelValue"])]),_:1},8,["span"]),ue(C(jl),{span:C(n)?24:12},{default:pe(()=>[ue(Ql,{label:"Multi Steps",prop:"multiStepsSwitch",modelValue:C(r).multiSelect.steps.enabled,"onUpdate:modelValue":g[18]||(g[18]=y=>C(r).multiSelect.steps.enabled=y)},null,8,["modelValue"])]),_:1},8,["span"])]),_:1})]),_:1})]),_:1},8,["modelValue"])]),ae("div",XX,[ue(C(ut),{onClick:g[20]||(g[20]=()=>C(r).resetStore()),class:"reset-btn"},{default:pe(()=>[Ye("Reset")]),_:1}),ue(C(ut),{type:"primary",class:"generate-cancel-btn",style:Fe(C(r).generating?"width: 55%;":""),onClick:g[21]||(g[21]=()=>C(r).generateImage(C(r).generatorType))},{default:pe(()=>[ae("span",null," Generate "+Pe(C(r).totalImageCount)+" image"+Pe(C(r).totalImageCount===1?"":"s"),1)]),_:1},8,["style"]),C(r).generating?(j(),_e(C(ut),{key:0,type:"danger",class:"generate-cancel-btn",style:{width:"25%"},disabled:C(r).cancelled,onClick:g[22]||(g[22]=()=>{C(r).cancelled=!0,C(r).generating=!1})},{default:pe(()=>[Ye("Cancel all")]),_:1},8,["disabled"])):be("",!0)]),ae("div",KX,[ue(C(PD),{class:"center-both generated-image"},{default:pe(()=>[!C(r).generating&&C(r).outputs.length==0?(j(),ce("div",GX,[/Inpainting/.test(C(r).generatorType)?(j(),_e(x0,{key:0})):be("",!0),/Img2Img/.test(C(r).generatorType)?(j(),_e(x0,{key:1})):be("",!0)])):be("",!0),!C(i).showGeneratedImages&&C(r).generating?(j(),_e(ZU,{key:1,generated:C(r).outputs.length,total:C(r).queue.length,elapsed:c(C(r).timer.seconds),onShowGenerated:g[23]||(g[23]=y=>C(i).showGeneratedImages=!0)},null,8,["generated","total","elapsed"])):be("",!0),C(i).showGeneratedImages&&C(r).outputs.length!==0?(j(),_e(mH,{key:2})):be("",!0)]),_:1})])]),_:1},8,["model","rules"]))])],64))}});const ys=kT({history:Ux("./"),routes:[{path:"/",name:"generate",component:qX},{path:"/images",name:"images",component:()=>Ef(()=>Promise.resolve().then(()=>UK),void 0,import.meta.url)},{path:"/about",name:"about",component:()=>Ef(()=>Promise.resolve().then(()=>nG),void 0,import.meta.url)},{path:"/options",name:"options",component:()=>Ef(()=>Promise.resolve().then(()=>cG),void 0,import.meta.url)},{path:"/return",name:"return",redirect:e=>(window.location.href=window.location.pathname.endsWith("/")?"..":".","/")}]});function Uf(){return{steps:25,n:1,sampler_name:"Euler",width:512,height:512,cfg_scale:7,clip_skip:0,seed:-1,denoising_strength:.6}}const kn=ya("generator",()=>{const e=["Text2Img","Img2Img","Inpainting"],t=["Img2Img","Inpainting"],n=se("Text2Img"),r=se(""),i=Dn("promptHistory",[]),l=se(""),m=Dn("negativeLibrary",[]),a=se(Uf()),o=se({interval:0,seconds:0}),u=se({sampler:{name:"Sampler",enabled:!1,selected:["Euler"],noneMessage:"Failed to generate: No sampler selected.",mapToParam:M=>M.sampler_name},steps:{name:"Steps",enabled:!1,selected:[30],noneMessage:"Failed to generate: No steps selected.",mapToParam:M=>M.steps},guidance:{name:"CFG Scale",enabled:!1,selected:[7],noneMessage:"Failed to generate: No guidance selected.",mapToParam:M=>M.cfg_scale},clipSkip:{name:"Clip Skip",enabled:!1,selected:[1],noneMessage:"Failed to generate: No CLIP Skip selected.",mapToParam:M=>M.clip_skip}}),h=()=>({sourceProcessing:void 0,sourceImage:void 0,maskImage:void 0}),c=se({...h(),sourceProcessing:"inpainting"}),f=se({...h(),sourceProcessing:"img2img"}),s=M=>M==="Inpainting"?c.value:M==="Img2Img"?f.value:h(),d=ee(()=>s(n.value)),v=se(""),g=se(!1),y=se(!1),b=se([]),_=se([]),w=se(64),S=ee(()=>en().allowLargerParams==="Enabled"?3072:1024),x=se(1),T=se(20),O=se(1),A=ee(()=>en().allowLargerParams==="Enabled"?500:50),$=se(1),N=se(24),D=se(.1),F=se(1),E=se(0),H=se(10),re=(M,U,ie)=>Array.from({length:(U-M+1)/ie},(te,G)=>(G+M)*ie),Q=se(re(E.value,H.value,1)),le=se(re($.value,N.value,.5)),I=ee(()=>{const M=(ne,ge,we=1)=>ne*(ge.enabled?ge.selected.length:we),ie=a.value.n*de().length,te=M(ie,u.value.sampler),G=M(te,u.value.steps),he=M(G,u.value.guidance);return M(he,u.value.clipSkip),he});function z(){return a.value=Uf(),c.value=h(),f.value=h(),b.value=[],$t().showGeneratedImages=!1,!0}async function L(M){if(!e.includes(M))return[];if(r.value==="")return Z("Failed to generate: No prompt submitted.");for(const Ae of Object.values(u.value))if(Ae.enabled&&Ae.selected.length===0)return Z(Ae.noneMessage);const U=hs(),ie=$t();U.saveImages();const{sourceImage:te,maskImage:G,sourceProcessing:he}=s(M);X(r.value);const ne=[],ge=(Ae,st)=>Ae.enabled?Ae.selected:st,we=de(),ke=ge(u.value.guidance,[a.value.cfg_scale]),Ee=ge(u.value.steps,[a.value.steps]),Be=ge(u.value.clipSkip,[a.value.clip_skip]),ye=ge(u.value.sampler,[a.value.sampler_name]),Se=[await W()];for(const Ae of ke)for(const st of Ee)for(const lt of Be)for(const Ge of we){const Mt=Ge.split(" ### ");for(const qt of ye)for(let Tr=0;Tr{o.value.seconds++},1e3);!_.value.every(Ae=>Ae.gathered||Ae.failed)&&!y.value;){const Ae=_.value.filter(lt=>!lt.gathered&&!lt.failed),st=Re(Ae);for(const[lt,Ge]of Ae.slice(0,st).entries()){if(y.value)break;Ge.gathered=!0;try{const Mt=await ve(Ge.params);if(!Mt){Ge.failed=!0;continue}R([{...Mt,...Ge}])}catch(Mt){Ge.failed=!0,console.error("Error fetching image:",Mt)}}}}async function R(M){const U=yo();console.log(M);const ie=await Promise.all(M.map(async he=>{const ne=he.images[0];return{id:-1,image:`data:image/png;base64,${ne}`,prompt:he.prompt,clip_skip:he.params.clip_skip,modelName:he.models[0],seed:he.params.seed,steps:he.params.steps,sampler_name:he.params.sampler_name,cfg_scale:he.params.cfg_scale,width:he.params.width,height:he.params.height}})),te=await U.pushOutputs(ie),G=0;return b.value=[...te.map(he=>({type:"image",index:G,output:he})),...b.value].sort((he,ne)=>he.index-ne.index),b.value.length===_.value.length&&(_.value=[],g.value=!1,$t().showGeneratedImages=!0,clearInterval(o.value.interval),o.value.interval=0,o.value.seconds=0),ie}async function Z(M){const U=$t();return M&&U.raiseError(M,!1),[]}function V(M,U,ie,te){return U<=ie?U:($t().raiseWarning(`This image was generated using the 'Larger Values' option. Setting '${M}' to its default value instead of ${U}.`,!0),te)}function P(M,U=!0){const ie=Uf();if(n.value="Text2Img",u.value.guidance.enabled=!1,u.value.sampler.enabled=!1,ys.push("/"),U&&(M.width=M.width||ie.width,M.height=M.height||ie.height),M.prompt){const te=M.prompt.split(" ### ");r.value=te[0],l.value=te[1]||""}M.sampler_name&&(a.value.sampler_name=M.sampler_name),M.steps&&(a.value.steps=V("steps",M.steps,A.value,ie.steps)),M.cfg_scale&&(a.value.cfg_scale=M.cfg_scale),M.width&&(a.value.width=V("width",M.width,S.value,ie.width)),M.height&&(a.value.height=V("height",M.height,S.value,ie.height)),M.seed&&(a.value.seed=M.seed),M.clip_skip&&(a.value.clip_skip=V("clip_skip",M.clip_skip,H.value,ie.clip_skip))}function q(M){const U=hs();n.value="Img2Img",f.value.sourceImage=M,U.drawing=!1,b.value=[],ys.push("/"),Kn.fabric.Image.fromURL(M,U.newImage)}function J(M){const U=hs();b.value=[],c.value.sourceImage=M,n.value="Inpainting",ys.push("/"),Kn.fabric.Image.fromURL(M,U.newImage)}function oe(){return l.value===""?r.value:`${r.value} ### ${l.value}`}function de(){const M=oe(),U=M.match(/\{(.*?)\}/g)||[];if(U.length===0)return[M];let ie=[];return U.forEach(te=>{const G=[],he=te.replace("{","").replace("}","").split("|");ie.length===0?he.forEach(ne=>{const ge=M.replace(te,ne);G.push(ge)}):ie.forEach(ne=>{he.forEach(ge=>{const we=ne.replace(te,ge);G.push(we)})}),ie=[...G]}),ie}async function ve(M){const U=en();try{const ie=await fetch(`${U.baseURL.length===0?".":U.baseURL}/sdapi/v1/${M.init_images.length>0?"img":"txt"}2img`,{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify(M)}),te=await ie.json();return gh(ie,te,200,"Failed to fetch",me)?te:!1}catch{return!1}}function me(M){return $t().raiseError(M,!1),y.value=!1,b.value=[],!1}async function W(){const M=en(),U=await fetch(`${M.baseURL.length===0?".":M.baseURL}/sdapi/v1/sd-models`),ie=await U.json();if(!!gh(U,ie,200,"Failed to get available models"))return ie.length===0?"(No model loaded)":ie[0].model_name}function K(M){m.value.indexOf(M)===-1&&(m.value=[...m.value,M])}function k(M){m.value=m.value.filter(U=>U!=M)}function X(M){if(i.value.findIndex(U=>U.prompt===M)===-1){if(i.value.length>=10+i.value.filter(U=>U.starred).length){const U=i.value.filter(te=>!te.starred),ie=i.value.findIndex(te=>te===U[U.length-1]);i.value.splice(ie,1)}i.value=[...i.value,{starred:!1,timestamp:Date.now(),prompt:M}]}}function Y(M){i.value=i.value.filter(U=>U.prompt!=M&&U!=M)}function B(){return!1}return{generatorType:n,prompt:r,params:a,outputs:b,inpainting:c,img2img:f,uploadDimensions:v,cancelled:y,multiSelect:u,negativePrompt:l,generating:g,negativePromptLibrary:m,minDimensions:w,maxDimensions:S,minImages:x,maxImages:T,minSteps:O,maxSteps:A,minCfgScale:$,maxCfgScale:N,minDenoise:D,maxDenoise:F,minClipSkip:E,maxClipSkip:H,clipSkipList:Q,cfgList:le,queue:_,promptHistory:i,timer:o,validGeneratorTypes:e,sourceGeneratorTypes:t,currentImageProps:d,totalImageCount:I,generateImage:L,generateText2Img:P,generateImg2Img:q,generateInpainting:J,getPrompt:B,resetStore:z,pushToNegativeLibrary:K,removeFromNegativeLibrary:k,pushToPromptHistory:X,removeFromPromptHistory:Y}});"stream"in Blob.prototype||Object.defineProperty(Blob.prototype,"stream",{value(){return new Response(this).body}});var Uc=e=>new DataView(new ArrayBuffer(e)),Lo=e=>new Uint8Array(e.buffer||e),Xo=e=>new TextEncoder().encode(String(e));function ZX(e,t){if(t===void 0||t instanceof Date||(t=new Date(t)),e instanceof File)return{t:t||new Date(e.lastModified),o:e.stream()};if(e instanceof Response)return{t:t||new Date(e.headers.get("Last-Modified")||Date.now()),o:e.body};if(t===void 0)t=new Date;else if(isNaN(t))throw new Error("Invalid modification date.");if(typeof e=="string")return{t,o:Xo(e)};if(e instanceof Blob)return{t,o:e.stream()};if(e instanceof Uint8Array||e instanceof ReadableStream)return{t,o:e};if(e instanceof ArrayBuffer||ArrayBuffer.isView(e))return{t,o:Lo(e)};if(Symbol.asyncIterator in e)return{t,o:B2(e)};throw new TypeError("Unsupported input format.")}function B2(e){const t="next"in e?e:e[Symbol.asyncIterator]();return new ReadableStream({async pull(n){let r=0;for(;n.desiredSize>r;){const i=await t.next();if(!i.value){n.close();break}{const l=JX(i.value);n.enqueue(l),r+=l.byteLength}}}})}function JX(e){return typeof e=="string"?Xo(e):e instanceof Uint8Array?e:Lo(e)}function QX(e,t,n){if(t===void 0||t instanceof Uint8Array||(t=Xo(t)),e instanceof File)return{i:t||Xo(e.name),A:e.size};if(e instanceof Response){const r=e.headers.get("content-disposition"),i=r&&r.match(/;\s*filename\*?=["']?(.*?)["']?$/i),l=i&&i[1]||new URL(e.url).pathname.split("/").pop(),m=l&&decodeURIComponent(l),a=n||+e.headers.get("content-length");return{i:t||Xo(m),A:a}}if(!t||t.length===0)throw new Error("The file must have a name.");return typeof e=="string"?{i:t,A:Xo(e).length}:e instanceof Blob?{i:t,A:e.size}:e instanceof ArrayBuffer||ArrayBuffer.isView(e)?{i:t,A:e.byteLength}:{i:t,A:n}}var eK=new WebAssembly.Instance(new WebAssembly.Module(Uint8Array.from(atob("AGFzbQEAAAABCgJgAABgAn9/AXwDAwIAAQUDAQACBwkCAW0CAAFjAAEIAQAKlQECSQEDfwNAIAEhAEEAIQIDQCAAQQF2IABBAXFBoIbi7X5scyEAIAJBAWoiAkEIRw0ACyABQQJ0IAA2AgAgAUEBaiIBQYACRw0ACwtJAQF/IAFBf3MhAUGAgAQhAkGAgAQgAGohAANAIAFB/wFxIAItAABzQQJ0KAIAIAFBCHZzIQEgAkEBaiICIABJDQALIAFBf3O4Cw"),e=>e.charCodeAt(0)))),{c:tK,m:nK}=eK.exports,rK=Lo(nK).subarray(65536);function dy(e,t=0){for(const n of function*(r){for(;r.length>65536;)yield r.subarray(0,65536),r=r.subarray(65536);r.length&&(yield r)}(e))rK.set(n),t=tK(n.length,t);return t}function F2(e,t,n=0){const r=e.getSeconds()>>1|e.getMinutes()<<5|e.getHours()<<11,i=e.getDate()|e.getMonth()+1<<5|e.getFullYear()-1980<<9;t.setUint16(n,r,1),t.setUint16(n+2,i,1)}function iK(e){const t=Uc(30);return t.setUint32(0,1347093252),t.setUint32(4,335546368),F2(e.t,t,10),t.setUint16(26,e.i.length,1),Lo(t)}async function*oK(e){let{o:t}=e;if("then"in t&&(t=await t),t instanceof Uint8Array)yield t,e.u=dy(t,0),e.A=t.length;else{e.A=0;const n=t.getReader();for(;;){const{value:r,done:i}=await n.read();if(i)break;e.u=dy(r,e.u),e.A+=r.length,yield r}}}function aK(e){const t=Uc(16);return t.setUint32(0,1347094280),t.setUint32(4,e.u,1),t.setUint32(8,e.A,1),t.setUint32(12,e.A,1),Lo(t)}function sK(e,t){const n=Uc(46);return n.setUint32(0,1347092738),n.setUint32(4,352523264),n.setUint16(8,2048),F2(e.t,n,12),n.setUint32(16,e.u,1),n.setUint32(20,e.A,1),n.setUint32(24,e.A,1),n.setUint16(28,e.i.length,1),n.setUint16(40,33204,1),n.setUint32(42,t,1),Lo(n)}function lK(e){return e instanceof File||e instanceof Response?[[e],[e]]:[[e.input,e.name,e.size],[e.input,e.lastModified]]}function uK(e,t={}){const n={"Content-Type":"application/zip","Content-Disposition":"attachment"};return Number.isInteger(t.length)&&t.length>0&&(n["Content-Length"]=t.length),t.metadata&&(n["Content-Length"]=p(t.metadata)),new Response(B2(async function*(r){const i=[];let l=0,m=0;for await(const u of r)yield iK(u),yield u.i,yield*oK(u),yield aK(u),i.push(sK(u,l)),i.push(u.i),m++,l+=46+u.i.length+u.A;let a=0;for(const u of i)yield u,a+=u.length;const o=Uc(22);o.setUint32(0,1347093766),o.setUint16(8,m,1),o.setUint16(10,m,1),o.setUint32(12,a,1),o.setUint32(16,l,1),yield Lo(o)}(async function*(r){for await(const i of r){const[l,m]=lK(i);yield Object.assign(ZX(...m),QX(...l))}}(e))),{headers:n})}async function z2(e,t=!0,n){const r=en();t&&Ii({message:`Downloading ${e.length} image(s)...`,type:"info"});const i=[];for(let a=0;a]/g,"").substring(0,128).trimEnd();r.imageDownloadType==="PNG"?i.push({name:f+".png",input:await ps(u,"image/png")}):r.imageDownloadType==="JPG"?i.push({name:f+".jpg",input:await ps(u,"image/jpeg")}):i.push({name:f+".webp",input:await ps(u,"image/webp")}),i.push({name:f+".json",input:JSON.stringify(c,void 0,4)}),n&&n()}const l=await uK(i).blob(),m=document.createElement("a");m.href=URL.createObjectURL(l),m.download="stable_horde.zip",m.click()}async function cK(e,t){const n=en(),r=document.createElement("a");let i;n.imageDownloadType==="PNG"?(i=await ps(e,"image/png"),r.href=URL.createObjectURL(i),r.download=t.replace(/[/\\:*?"<>]/g,"").substring(0,128).trimEnd()+".png"):n.imageDownloadType==="JPG"?(i=await ps(e,"image/jpeg"),r.href=URL.createObjectURL(i),r.download=t.replace(/[/\\:*?"<>]/g,"").substring(0,128).trimEnd()+".jpg"):(r.href=e,r.download=t.replace(/[/\\:*?"<>]/g,"").substring(0,128).trimEnd()+".webp"),r.click(),i&&URL.revokeObjectURL(r.href)}const N2=Te({__name:"ImageActions",props:{imageData:null,onDelete:null},setup(e){const t=e,n=kn(),r=yo(),i=()=>{nw.confirm("This action will permanently delete this image. Continue?","Warning",{confirmButtonText:"OK",cancelButtonText:"Cancel",type:"warning"}).then(()=>{r.deleteOutput(t.imageData.id),t.onDelete!==void 0&&t.onDelete(t.imageData.id),Ii({type:"success",message:"Deleted Image"})})};async function l(m){const a=window.location.origin,o={prompt:m.prompt,width:m.width?m.width:void 0,height:m.height?m.height:void 0,steps:m.steps,cfg_scale:m.cfg_scale,sampler_name:m.sampler_name,model_name:m.modelName,seed:m.seed,clip_skip:m.clip_skip},u=window.location.pathname.replace("images","");let h=`${a}${u}?share=`,c="",f="";for(const[d,v]of Object.entries(o)){if(!v)continue;let g=v;typeof v=="string"?g=encodeURIComponent(v):Array.isArray(v)&&(g=JSON.stringify(v)),c+=`${f}${d}=${g}`,f="&"}h+=btoa(String.fromCharCode.apply(null,Array.from(SX(c)))),await navigator.clipboard.writeText(h),Ii({type:"success",message:"Copied shareable link to clipboard"})}return(m,a)=>(j(),ce(ze,null,[ue(C(ut),{onClick:i,type:"danger",icon:C(xc),plain:""},{default:pe(()=>[Ye("Delete")]),_:1},8,["icon"]),ue(C(ut),{onClick:a[0]||(a[0]=o=>C(cK)(e.imageData.image,`${e.imageData.seed}-${e.imageData.prompt}`)),type:"success",icon:C(As),plain:""},{default:pe(()=>[Ye("Download")]),_:1},8,["icon"]),e.imageData.starred?be("",!0):(j(),_e(C(ut),{key:0,onClick:a[1]||(a[1]=o=>C(r).toggleStarred(e.imageData.id)),type:"warning",icon:C(LO),plain:""},{default:pe(()=>[Ye("Favourite")]),_:1},8,["icon"])),e.imageData.starred?(j(),_e(C(ut),{key:1,onClick:a[2]||(a[2]=o=>C(r).toggleStarred(e.imageData.id)),type:"warning",icon:C(Gb),plain:""},{default:pe(()=>[Ye("Unfavourite")]),_:1},8,["icon"])):be("",!0),ue(C(ut),{onClick:a[3]||(a[3]=o=>C(n).generateText2Img(e.imageData)),type:"success",icon:C(rs),plain:""},{default:pe(()=>[Ye("Text2img")]),_:1},8,["icon"]),ue(C(ut),{onClick:a[4]||(a[4]=o=>C(n).generateImg2Img(e.imageData.image)),type:"success",icon:C(rs),plain:""},{default:pe(()=>[Ye("Img2img")]),_:1},8,["icon"]),ue(C(ut),{onClick:a[5]||(a[5]=o=>C(n).generateInpainting(e.imageData.image)),type:"success",icon:C(rs),plain:""},{default:pe(()=>[Ye("Inpainting")]),_:1},8,["icon"]),ue(C(ut),{onClick:a[6]||(a[6]=o=>l(e.imageData)),type:"success",icon:C(KE),plain:""},{default:pe(()=>[Ye("Copy Link")]),_:1},8,["icon"])],64))}}),fK={style:{"font-size":"18px","font-weight":"500"}},dK={style:{"font-family":"'Segoe UI', Tahoma, Geneva, Verdana, sans-serif","letter-spacing":"0.025em"}},hK=Te({__name:"ImageDialog",setup(e){const t=yo(),n=$t(),r=se();TI(r,{onSwipeEnd(a,o){o==="RIGHT"&&n.openModalToLeft(),o==="LEFT"&&n.openModalToRight()}});const i=ee({get(){return n.activeModal!==-1},set(){n.activeModal=-1}}),l=se(t.currentOutputs[0]);xe(()=>n.activeModal,async()=>{const a=t.currentOutputs.find(o=>o.id===n.activeModal);if(a)return l.value=a;l.value=await Lt.outputs.get(n.activeModal)||t.currentOutputs[0]});function m(){i.value=!1}return(a,o)=>{var u;return j(),_e(C(mB),{"model-value":C(i),width:(u=l.value)==null?void 0:u.width,class:"image-viewer",onClosed:m,"align-center":""},{default:pe(()=>{var h,c;return[ae("div",{class:"main-output-container",ref_key:"target",ref:r},[ae("div",{class:"main-output",style:Fe({backgroundImage:`url(${l.value.image||""})`,backgroundSize:"contain",backgroundRepeat:"no-repeat",backgroundPosition:"center center"})},null,4)],512),ae("div",fK,Pe(((h=l.value.prompt)==null?void 0:h.split("###")[0])||"Unkown Creation"),1),ae("div",dK,[ae("div",null,"Negative Prompt: "+Pe(((c=l.value.prompt)==null?void 0:c.split("###")[1])||"None"),1),ae("span",null,"Model: "+Pe(l.value.modelName||"Unknown")+" - ",1),ae("span",null,"Sampler: "+Pe(l.value.sampler_name||"Unknown")+" - ",1),ae("span",null,"Seed: "+Pe(l.value.seed||"Unknown")+" - ",1),ae("span",null,"Steps: "+Pe(l.value.steps||"Unknown")+" - ",1),ae("span",null,"CFG Scale: "+Pe(l.value.cfg_scale||"Unknown")+" - ",1),ae("span",null,"Clip Skip: "+Pe(l.value.clip_skip||"Unknown")+" - ",1),ae("span",null,"Dimensions: "+Pe(l.value.width||"???")+"x"+Pe(l.value.height||"???")+" - ",1)]),ae("div",null,[ue(N2,{"image-data":l.value},null,8,["image-data"])])]}),_:1},8,["model-value","width"])}}});const pK=e=>(Gr("data-v-8f4d2380"),e=e(),qr(),e),gK=pK(()=>ae("div",{style:{"font-size":"20px"}},"Stable UI",-1)),vK={class:"generator-icons"},mK=Te({__name:"App",setup(e){const n=sp(ap).smallerOrEqual("md"),r=$t();en();const i=OT(),l=se();return xe(()=>i.path,m=>{l.value&&l.value.open(m)}),(m,a)=>(j(),ce(ze,null,[ae("div",{class:fe({"menu-container":!C(n)})},[ue(C(H1),{"default-active":C(i).path,mode:"horizontal",router:!0,ellipsis:!C(n),class:fe(C(n)?"mobile-menu":"menu"),ref_key:"menuRef",ref:l},{default:pe(()=>[C(n)?be("",!0):(j(),_e(C(Tp),{key:0,class:"remove-item-styling center-vertical"},{title:pe(()=>[gK]),_:1})),ue(ja,{isMobile:C(n),index:"/"},{icon:pe(()=>[ae("div",vK,[ue(C(Le),null,{default:pe(()=>[ue(C(L3))]),_:1}),C(r).showGeneratorBadge?(j(),_e(C(Le),{key:0,class:"generator-badge",size:10},{default:pe(()=>[ue(OU)]),_:1})):be("",!0)])]),title:pe(()=>[Ye("Generate")]),_:1},8,["isMobile"]),ue(ja,{isMobile:C(n),index:"/images"},{icon:pe(()=>[ue(C(Le),null,{default:pe(()=>[ue(C(f3))]),_:1})]),title:pe(()=>[Ye("Images")]),_:1},8,["isMobile"]),ue(ja,{isMobile:C(n),index:"/about"},{icon:pe(()=>[ue(C(Le),null,{default:pe(()=>[ue(C(Wb))]),_:1})]),title:pe(()=>[Ye("About")]),_:1},8,["isMobile"]),ue(ja,{isMobile:C(n),index:"/options"},{icon:pe(()=>[ue(C(Le),null,{default:pe(()=>[ue(C(HO))]),_:1})]),title:pe(()=>[Ye("Options")]),_:1},8,["isMobile"]),ue(ja,{isMobile:C(n),index:"/return"},{icon:pe(()=>[ue(C(Le),null,{default:pe(()=>[ue(C(jb))]),_:1})]),title:pe(()=>[Ye("Return to Lite")]),_:1},8,["isMobile"])]),_:1},8,["default-active","ellipsis","class"])],2),ae("div",{class:fe({view:!C(n)})},[ue(C(Nb))],2),ue(hK)],64))}});const yK=Yt(mK,[["__scopeId","data-v-8f4d2380"]]);const sg=yx(yK);sg.use(wx());sg.use(ys);sg.mount("#app");ys.replace("/");const bK={key:1,class:"image-action"},_K=Te({__name:"CustomImage",props:{imageData:null},setup(e){const t=e,n=$t(),r=se(null);rI(r,n.toggleMultiSelect,{modifiers:{prevent:!0}});const i=se(!1);xI(r,([{isIntersecting:m}])=>{m&&(i.value=m)},{rootMargin:"500px"});const l=ee(()=>n.selected.includes(t.imageData.id));return(m,a)=>(j(),ce("div",{class:"relative",ref_key:"containerRef",ref:r},[i.value?(j(),_e(C(Sp),{key:0,class:"thumbnail",src:e.imageData.image,onClick:a[0]||(a[0]=o=>C(n).activeModal=e.imageData.id),fit:"cover",loading:"lazy",style:Fe(`${C(l)&&"opacity: 0.5"}`)},null,8,["src","style"])):be("",!0),i.value?(j(),ce("div",bK,[e.imageData.starred?(j(),_e(C(Le),{key:0,class:"starred-icon",size:35,color:"var(--el-color-warning)"},{default:pe(()=>[ue(C(Gb))]),_:1})):be("",!0),C(n).multiSelect?(j(),ce("div",{key:1,class:"select-container",onClick:a[1]||(a[1]=o=>C(n).toggleSelection(e.imageData.id))},[ue(C(Le),{class:"select-icon",size:35,color:`rgba(255, 255, 255, ${C(l)?"1":"0.5"})`},{default:pe(()=>[C(l)?be("",!0):(j(),_e(C(sl),{key:0})),C(l)?(j(),_e(C(Ub),{key:1})):be("",!0)]),_:1},8,["color"])])):be("",!0)])):be("",!0)],512))}});const hy=Yt(_K,[["__scopeId","data-v-b9569bbd"]]);const wK={},CK={xmlns:"http://www.w3.org/2000/svg","xmlns:xlink":"http://www.w3.org/1999/xlink",viewBox:"0 0 1024 1024"},SK=ae("path",{d:"M880 112H144c-17.7 0-32 14.3-32 32v736c0 17.7 14.3 32 32 32h736c17.7 0 32-14.3 32-32V144c0-17.7-14.3-32-32-32zm-696 72h136v656H184V184zm656 656H384V384h456v456zM384 320V184h456v136H384z",fill:"currentColor"},null,-1),xK=[SK];function TK(e,t){return j(),ce("svg",CK,xK)}const kK=Yt(wK,[["render",TK]]),EK=e=>(Gr("data-v-301360a8"),e=e(),qr(),e),OK={class:"images-top-bar"},AK={class:"options"},PK=["onClick"],IK=["onClick"],MK=["onClick"],LK={key:1,class:"center-both",style:{gap:"12px"}},RK={key:2},DK=EK(()=>ae("em",{style:{"font-size":"14px"}},"(long press to select multiple images)",-1)),$K=[DK],BK={key:0},FK={key:0,style:{display:"flex",gap:"8px"}},zK={key:1,class:"images"},NK={key:1},jK=Te({__name:"ImagesView",setup(e){const{width:t}=RI(),n=yo(),r=en(),i=$t();function l(){i.selected=i.selected.filter(f=>!n.currentOutputs.map(s=>s.id).includes(f)),i.selected=[...i.selected,...n.currentOutputs.map(f=>f.id)],i.multiSelect=!0}async function m(){const f=await Lt.outputs.toCollection().primaryKeys();i.selected=f,i.multiSelect=!0}function a(){i.selected=i.selected.filter(f=>!n.currentOutputs.map(s=>s.id).includes(f)),i.selected.length===0&&(i.multiSelect=!1)}function o(){i.selected=[],i.multiSelect=!1}const u=()=>{nw.confirm(`This action will permanently delete ${i.selected.length} images. Continue?`,"Warning",{confirmButtonText:"OK",cancelButtonText:"Cancel",type:"warning"}).then(()=>{n.deleteMultipleOutputs(i.selected)})};Kv(["a","A","ArrowLeft"],i.openModalToLeft),Kv(["d","D","ArrowRight"],i.openModalToRight);async function h(){z2(i.selected)}const c=ee(()=>{let f=2;t.value>1440?f=6:t.value>1280?f=5:t.value>768?f=4:t.value>480&&(f=3);const s=[];for(let d=0;d(j(),ce(ze,null,[ae("div",OK,[ae("div",AK,[ue(C(Hl),{placement:"bottom",title:"Sort By",trigger:"click",width:200,transition:"none","hide-after":0},{reference:pe(()=>[ue(C(ut),{class:"btn-select"},{default:pe(()=>[ue(C(Le),{size:16},{default:pe(()=>[ue(C(CO))]),_:1})]),_:1})]),default:pe(()=>[(j(),ce(ze,null,Dt(["Newest","Oldest"],d=>ae("div",{key:d,onClick:()=>C(n).sortBy=d,class:fe(`el-select-dropdown__item ${C(n).sortBy===d?"selected":""}`)},Pe(d),11,PK)),64))]),_:1}),ue(C(Hl),{placement:"bottom",title:"Filter By",trigger:"click",width:240,transition:"none","hide-after":0},{reference:pe(()=>[ue(C(ut),{class:"btn-select"},{default:pe(()=>[ue(C(Le),{size:16},{default:pe(()=>[ue(C(xE))]),_:1})]),_:1})]),default:pe(()=>[(j(),ce(ze,null,Dt(["all","favourited","unfavourited","unrated"],d=>ae("div",{key:d,onClick:()=>C(n).filterBy=d,class:fe(`el-select-dropdown__item ${C(n).filterBy===d?"selected":""}`)},Pe(C(n).filterBy===d?"Showing":"Show")+" "+Pe(d),11,IK)),64))]),_:1}),ue(C(Hl),{placement:"bottom",title:"Image Layout",trigger:"click",width:240,transition:"none","hide-after":0},{reference:pe(()=>[ue(C(ut),{class:"btn-select"},{default:pe(()=>[ue(C(Le),{size:16},{default:pe(()=>[ue(kK)]),_:1})]),_:1})]),default:pe(()=>[(j(),ce(ze,null,Dt([{label:"Square Grid",value:"grid"},{label:"Dynamic Layout",value:"dynamic"}],d=>ae("div",{key:d.value,onClick:()=>C(n).currentLayout=d.value,class:fe(`el-select-dropdown__item ${C(n).currentLayout===d.value?"selected":""}`)},Pe(d.label),11,MK)),64))]),_:1}),ue(C(Hl),{placement:"bottom",title:"Selection",trigger:"click",width:240,transition:"none","hide-after":0},{reference:pe(()=>[ue(C(ut),{class:"btn-select"},{default:pe(()=>[ue(C(Le),{size:16},{default:pe(()=>[C(i).multiSelect?(j(),_e(C(Ub),{key:0})):(j(),_e(C(sl),{key:1}))]),_:1})]),_:1})]),default:pe(()=>[C(i).multiSelect?(j(),ce("div",{key:0,class:"el-select-dropdown__item selected",onClick:s[0]||(s[0]=(...d)=>C(i).toggleMultiSelect&&C(i).toggleMultiSelect(...d))},"Disable multi-select")):(j(),ce("div",{key:1,class:"el-select-dropdown__item",onClick:s[1]||(s[1]=(...d)=>C(i).toggleMultiSelect&&C(i).toggleMultiSelect(...d))},"Enable multi-select")),C(i).selected.length>0?(j(),ce("div",{key:2,class:"el-select-dropdown__item selected",onClick:o},"Deselect All")):(j(),ce("div",{key:3,class:"el-select-dropdown__item",onClick:m},"Select All")),C(i).selected.every(d=>!C(n).currentOutputs.map(v=>v.id).includes(d))?(j(),ce("div",{key:5,class:"el-select-dropdown__item",onClick:l},"Select Page")):(j(),ce("div",{key:4,class:"el-select-dropdown__item selected",onClick:a},"Deselect Page"))]),_:1})]),C(r).pageless==="Disabled"?(j(),_e(C(jN),{key:0,layout:"prev, pager, next",total:C(n).outputsLength,"page-size":C(r).pageSize,"current-page":C(n).currentPage,"onUpdate:currentPage":s[2]||(s[2]=d=>C(n).currentPage=d),"hide-on-single-page":""},null,8,["total","page-size","current-page"])):be("",!0),C(i).multiSelect?(j(),ce("div",LK,[ae("div",null,Pe(C(i).selected.length)+" selected",1),ue(C(ut),{type:"danger",onClick:u,icon:C(xc),plain:""},{default:pe(()=>[Ye("Delete")]),_:1},8,["icon"]),ue(C(ut),{type:"success",onClick:h,icon:C(As),plain:"",style:{margin:"0"}},{default:pe(()=>[Ye("Download")]),_:1},8,["icon"])])):(j(),ce("div",RK,$K))]),C(n).outputsLength!=0?(j(),ce("div",BK,[C(n).currentLayout==="dynamic"?(j(),ce("div",FK,[(j(!0),ce(ze,null,Dt(C(c),(d,v)=>(j(),ce("div",{key:v,style:{flex:"1 1 0%"}},[(j(!0),ce(ze,null,Dt(d,g=>(j(),_e(hy,{key:g.id,"image-data":g,style:{"margin-bottom":"8px"}},null,8,["image-data"]))),128))]))),128))])):be("",!0),C(n).currentLayout==="grid"?(j(),ce("div",zK,[(j(!0),ce(ze,null,Dt(C(n).currentOutputs,d=>(j(),_e(hy,{key:d.id,"image-data":d,style:{width:"200px",height:"200px"}},null,8,["image-data"]))),128))])):be("",!0)])):be("",!0),C(n).outputsLength==0?(j(),ce("div",NK,[ue(C(cF),{description:"No Images Found"})])):be("",!0)],64))}});const VK=Yt(jK,[["__scopeId","data-v-301360a8"]]),UK=Object.freeze(Object.defineProperty({__proto__:null,default:VK},Symbol.toStringTag,{value:"Module"})),HK=["href"],WK=Te({__name:"BaseLink",props:{href:null,router:{type:Boolean}},setup(e){return(t,n)=>{const r=ht("router-link");return j(),ce(ze,null,[e.router?be("",!0):(j(),ce("a",{key:0,target:"_blank",rel:"noreferrer noopener",href:e.href},[Ce(t.$slots,"default",{},void 0,!0)],8,HK)),e.router?(j(),_e(r,{key:1,to:e.href},{default:pe(()=>[Ce(t.$slots,"default",{},void 0,!0)]),_:3},8,["to"])):be("",!0)],64)}}});const YK=Yt(WK,[["__scopeId","data-v-17b53b7d"]]),Tl=e=>(Gr("data-v-f86e7d02"),e=e(),qr(),e),XK={class:"about"},KK={class:"about-content"},GK=Tl(()=>ae("h1",{style:{"margin-top":"0"}},"Stable UI",-1)),qK=Tl(()=>ae("div",null,"This tool was originally a front-end for the AI Horde and has since been converted for local generations with the A1111 API, such as in KoboldCpp.",-1)),ZK=Tl(()=>ae("br",null,null,-1)),JK=Tl(()=>ae("div",null,"If you want to help improve this tool, you can find the currently maintained source code from this modified version on https://github.com/LostRuins/stable-ui and https://github.com/henk717/stable-ui, which is based off https://github.com/ayunami2000/stable-ui, which derives from the original AI Horde version on https://github.com/aqualxx/stable-ui (Original author aqualxx#5004). Feel free to contribute!",-1)),QK=Tl(()=>ae("br",null,null,-1)),eG=Te({__name:"AboutView",setup(e){return(t,n)=>(j(),ce("div",XK,[ae("div",KK,[GK,qK,ZK,JK,QK,ae("div",null,[Ye("You can find the KoboldAI community and authors of this fork on the "),ue(YK,{href:"https://koboldai.org/discord"},{default:pe(()=>[Ye("KoboldAI Discord")]),_:1})])])]))}});const tG=Yt(eG,[["__scopeId","data-v-f86e7d02"]]),nG=Object.freeze(Object.defineProperty({__proto__:null,default:tG},Symbol.toStringTag,{value:"Module"}));const Hf=Te({__name:"FormRadio",props:{label:null,modelValue:null,prop:null,useBoolean:{type:Boolean},options:null,disabled:{type:Boolean},info:null,labelStyle:null,change:null},emits:["update:modelValue"],setup(e,{emit:t}){const n=e;function r(l){if(n.useBoolean&&l==="Enabled"?t("update:modelValue",!0):n.useBoolean&&l==="Disabled"?t("update:modelValue",!1):t("update:modelValue",l),!!n.change)return n.useBoolean&&l==="Enabled"?n.change(!0):n.useBoolean&&l==="Disabled"?n.change(!1):n.change(l)}const i=ee(()=>n.useBoolean?n.modelValue===!0?"Enabled":n.modelValue===!1?"Disabled":n.modelValue:n.modelValue);return(l,m)=>(j(),_e(C(wi),{prop:e.prop},{label:pe(()=>[ue(_l,{info:e.info,"label-style":e.labelStyle},{default:pe(()=>[Ce(l.$slots,"label",{},()=>[Ye(Pe(e.label),1)])]),_:3},8,["info","label-style"])]),default:pe(()=>[ue(C(i$),{disabled:e.disabled,"model-value":C(i),onChange:r},{default:pe(()=>[(j(!0),ce(ze,null,Dt(e.options,a=>(j(),_e(C(o$),{key:a,label:a},null,8,["label"]))),128))]),_:1},8,["disabled","model-value"]),Ce(l.$slots,"inline")]),_:3},8,["prop"]))}}),kl=e=>(Gr("data-v-1aa3949b"),e=e(),qr(),e),rG=kl(()=>ae("h1",null,"Options",-1)),iG=kl(()=>ae("h2",null,"Generation Options",-1)),oG=kl(()=>ae("h2",null,"Image Options",-1)),aG=kl(()=>ae("div",null,[Ye("Drop file here OR "),ae("em",null,"click to upload")],-1)),sG=kl(()=>ae("h2",null,"General Options",-1)),lG=Te({__name:"OptionsView",setup(e){const t=en(),n=yo(),r=[{value:"dark",label:"Dark"},{value:"light",label:"Light"},{value:"auto",label:"Auto"}],i=se([]),l=se(),m=se(!1),a=se(0);async function o(h){n.importFromZip(h),l.value.clearFiles()}async function u(){Ii({message:`Downloading ${n.outputsLength} image(s)... (this may take a while)`,type:"info"}),m.value=!0,a.value=0;const h=await Lt.outputs.toCollection().primaryKeys();await z2(h,!1,()=>{a.value++}),m.value=!1,a.value=0}return(h,c)=>(j(),ce(ze,null,[rG,ue(C(Cp),{"label-position":"top",model:C(t).options,onSubmit:c[7]||(c[7]=Qe(()=>{},["prevent"]))},{default:pe(()=>[ue(C(d9),{type:"border-card",style:{"min-height":"50vh"}},{default:pe(()=>[ue(C(mf),{label:"\u{1F5A8}\uFE0F Generation"},{default:pe(()=>[iG,ue(C(wi),{label:"Base URL"},{default:pe(()=>[ue(C(Po),{class:"apikey",prop:"baseURL",modelValue:C(t).baseURL,"onUpdate:modelValue":c[0]||(c[0]=f=>C(t).baseURL=f)},null,8,["modelValue"])]),_:1})]),_:1}),ue(C(mf),{label:"\u{1F4F7} Images"},{default:pe(()=>[oG,ue(Rn,{label:"Images Per Page",prop:"pageSize",modelValue:C(t).pageSize,"onUpdate:modelValue":c[1]||(c[1]=f=>C(t).pageSize=f),min:10,max:50,step:5,disabled:C(t).pageless==="Enabled"},null,8,["modelValue","disabled"]),ue(Hf,{label:"Pageless Format",prop:"pageless",modelValue:C(t).pageless,"onUpdate:modelValue":c[2]||(c[2]=f=>C(t).pageless=f),options:["Enabled","Disabled"]},null,8,["modelValue"]),ue(Hf,{label:"Carousel Auto Cycle",prop:"autoCarousel",modelValue:C(t).autoCarousel,"onUpdate:modelValue":c[3]||(c[3]=f=>C(t).autoCarousel=f),options:["Enabled","Disabled"]},null,8,["modelValue"]),ue(Hf,{label:"Image Download Format",prop:"downloadType",modelValue:C(t).imageDownloadType,"onUpdate:modelValue":c[4]||(c[4]=f=>C(t).imageDownloadType=f),options:["PNG","JPG","WEBP"]},null,8,["modelValue"]),ue(C(wi),{label:"Export Images (ZIP File)"},{default:pe(()=>[m.value?(j(),_e(C(ut),{key:1,icon:C(As),disabled:""},{default:pe(()=>[Ye("Downloading... ("+Pe(a.value)+" / "+Pe(C(n).outputsLength)+" image(s))",1)]),_:1},8,["icon"])):(j(),_e(C(ut),{key:0,icon:C(As),onClick:c[5]||(c[5]=f=>u())},{default:pe(()=>[Ye("Download "+Pe(C(n).outputsLength)+" image(s)",1)]),_:1},8,["icon"]))]),_:1}),ue(C(wi),{label:"Import Images (ZIP File)"},{default:pe(()=>[ue(C(Op),{drag:"",ref_key:"upload",ref:l,"auto-upload":!1,onChange:o,"file-list":i.value,limit:1,multiple:""},{default:pe(()=>[ue(C(Le),{size:100},{default:pe(()=>[ue(C(Yh))]),_:1}),aG]),_:1},8,["file-list"])]),_:1})]),_:1}),ue(C(mf),{label:"\u2699\uFE0F General"},{default:pe(()=>[sG,ue(ih,{label:"Color Scheme",prop:"colorScheme",modelValue:C(t).options.colorMode,"onUpdate:modelValue":c[6]||(c[6]=f=>C(t).options.colorMode=f),options:r},null,8,["modelValue"])]),_:1})]),_:1})]),_:1},8,["model"])],64))}});const uG=Yt(lG,[["__scopeId","data-v-1aa3949b"]]),cG=Object.freeze(Object.defineProperty({__proto__:null,default:uG},Symbol.toStringTag,{value:"Module"})); diff --git a/koboldcpp.py b/koboldcpp.py index 5a71d58cf..490650ab3 100644 --- a/koboldcpp.py +++ b/koboldcpp.py @@ -2117,7 +2117,7 @@ def transform_genparams(genparams, api_format): # note: message string already contains the instruct start tag! temp_poll = { "prompt": f"{messages_string}\n\nTool List:\n{tools_string}\n\n{custom_tools_prompt}{user_end}", - "max_length":4, + "max_length":6, "temperature":0.1, "top_k":1, "rep_pen":1,