@storecraft/dashboard 1.0.11 → 1.0.12

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
@@ -110,7 +110,7 @@ ${e}</tr>
110
110
  `}tablecell(e,n){const r=n.header?"th":"td";return(n.align?`<${r} align="${n.align}">`:`<${r}>`)+e+`</${r}>
111
111
  `}strong(e){return`<strong>${e}</strong>`}em(e){return`<em>${e}</em>`}codespan(e){return`<code>${e}</code>`}br(){return this.options.xhtml?"<br/>":"<br>"}del(e){return`<del>${e}</del>`}link(e,n,r){if(e=l8(this.options.sanitize,this.options.baseUrl,e),e===null)return r;let i='<a href="'+e+'"';return n&&(i+=' title="'+n+'"'),i+=">"+r+"</a>",i}image(e,n,r){if(e=l8(this.options.sanitize,this.options.baseUrl,e),e===null)return r;let i=`<img src="${e}" alt="${r}"`;return n&&(i+=` title="${n}"`),i+=this.options.xhtml?"/>":">",i}text(e){return e}}class iv{strong(e){return e}em(e){return e}codespan(e){return e}del(e){return e}html(e){return e}text(e){return e}link(e,n,r){return""+r}image(e,n,r){return""+r}br(){return""}}class sv{constructor(){this.seen={}}serialize(e){return e.toLowerCase().trim().replace(/<[!\/a-z].*?>/ig,"").replace(/[\u2000-\u206F\u2E00-\u2E7F\\'!"#$%&()*+,./:;<=>?@[\]^`{|}~]/g,"").replace(/\s/g,"-")}getNextSafeSlug(e,n){let r=e,i=0;if(this.seen.hasOwnProperty(r)){i=this.seen[e];do i++,r=e+"-"+i;while(this.seen.hasOwnProperty(r))}return n||(this.seen[e]=i,this.seen[r]=0),r}slug(e,n={}){const r=this.serialize(e);return this.getNextSafeSlug(r,n.dryrun)}}let nl=class _4{constructor(e){this.options=e||ko,this.options.renderer=this.options.renderer||new mm,this.renderer=this.options.renderer,this.renderer.options=this.options,this.textRenderer=new iv,this.slugger=new sv}static parse(e,n){return new _4(n).parse(e)}static parseInline(e,n){return new _4(n).parseInline(e)}parse(e,n=!0){let r="",i,s,a,o,l,c,u,d,h,p,m,g,y,v,x,b,w,C,S;const k=e.length;for(i=0;i<k;i++){if(p=e[i],this.options.extensions&&this.options.extensions.renderers&&this.options.extensions.renderers[p.type]&&(S=this.options.extensions.renderers[p.type].call({parser:this},p),S!==!1||!["space","hr","heading","code","table","blockquote","list","html","paragraph","text"].includes(p.type))){r+=S||"";continue}switch(p.type){case"space":continue;case"hr":{r+=this.renderer.hr();continue}case"heading":{r+=this.renderer.heading(this.parseInline(p.tokens),p.depth,XC(this.parseInline(p.tokens,this.textRenderer)),this.slugger);continue}case"code":{r+=this.renderer.code(p.text,p.lang,p.escaped);continue}case"table":{for(d="",u="",o=p.header.length,s=0;s<o;s++)u+=this.renderer.tablecell(this.parseInline(p.header[s].tokens),{header:!0,align:p.align[s]});for(d+=this.renderer.tablerow(u),h="",o=p.rows.length,s=0;s<o;s++){for(c=p.rows[s],u="",l=c.length,a=0;a<l;a++)u+=this.renderer.tablecell(this.parseInline(c[a].tokens),{header:!1,align:p.align[a]});h+=this.renderer.tablerow(u)}r+=this.renderer.table(d,h);continue}case"blockquote":{h=this.parse(p.tokens),r+=this.renderer.blockquote(h);continue}case"list":{for(m=p.ordered,g=p.start,y=p.loose,o=p.items.length,h="",s=0;s<o;s++)x=p.items[s],b=x.checked,w=x.task,v="",x.task&&(C=this.renderer.checkbox(b),y?x.tokens.length>0&&x.tokens[0].type==="paragraph"?(x.tokens[0].text=C+" "+x.tokens[0].text,x.tokens[0].tokens&&x.tokens[0].tokens.length>0&&x.tokens[0].tokens[0].type==="text"&&(x.tokens[0].tokens[0].text=C+" "+x.tokens[0].tokens[0].text)):x.tokens.unshift({type:"text",text:C}):v+=C),v+=this.parse(x.tokens,y),h+=this.renderer.listitem(v,w,b);r+=this.renderer.list(h,m,g);continue}case"html":{r+=this.renderer.html(p.text,p.block);continue}case"paragraph":{r+=this.renderer.paragraph(this.parseInline(p.tokens));continue}case"text":{for(h=p.tokens?this.parseInline(p.tokens):p.text;i+1<k&&e[i+1].type==="text";)p=e[++i],h+=`
112
112
  `+(p.tokens?this.parseInline(p.tokens):p.text);r+=n?this.renderer.paragraph(h):h;continue}default:{const N='Token with "'+p.type+'" type was not found.';if(this.options.silent){console.error(N);return}else throw new Error(N)}}}return r}parseInline(e,n){n=n||this.renderer;let r="",i,s,a;const o=e.length;for(i=0;i<o;i++){if(s=e[i],this.options.extensions&&this.options.extensions.renderers&&this.options.extensions.renderers[s.type]&&(a=this.options.extensions.renderers[s.type].call({parser:this},s),a!==!1||!["escape","html","link","image","strong","em","codespan","br","del","text"].includes(s.type))){r+=a||"";continue}switch(s.type){case"escape":{r+=n.text(s.text);break}case"html":{r+=n.html(s.text);break}case"link":{r+=n.link(s.href,s.title,this.parseInline(s.tokens,n));break}case"image":{r+=n.image(s.href,s.title,s.text);break}case"strong":{r+=n.strong(this.parseInline(s.tokens,n));break}case"em":{r+=n.em(this.parseInline(s.tokens,n));break}case"codespan":{r+=n.codespan(s.text);break}case"br":{r+=n.br();break}case"del":{r+=n.del(this.parseInline(s.tokens,n));break}case"text":{r+=n.text(s.text);break}default:{const l='Token with "'+s.type+'" type was not found.';if(this.options.silent){console.error(l);return}else throw new Error(l)}}}return r}};class L1{constructor(e){this.options=e||ko}preprocess(e){return e}postprocess(e){return e}}ee(L1,"passThroughHooks",new Set(["preprocess","postprocess"]));var Nl,b4,JC;class ER{constructor(...e){$r(this,Nl);ee(this,"defaults",rv());ee(this,"options",this.setOptions);ee(this,"parse",Pf(this,Nl,b4).call(this,ls.lex,nl.parse));ee(this,"parseInline",Pf(this,Nl,b4).call(this,ls.lexInline,nl.parseInline));ee(this,"Parser",nl);ee(this,"parser",nl.parse);ee(this,"Renderer",mm);ee(this,"TextRenderer",iv);ee(this,"Lexer",ls);ee(this,"lexer",ls.lex);ee(this,"Tokenizer",pm);ee(this,"Slugger",sv);ee(this,"Hooks",L1);this.use(...e)}walkTokens(e,n){let r=[];for(const i of e)switch(r=r.concat(n.call(this,i)),i.type){case"table":{for(const s of i.header)r=r.concat(this.walkTokens(s.tokens,n));for(const s of i.rows)for(const a of s)r=r.concat(this.walkTokens(a.tokens,n));break}case"list":{r=r.concat(this.walkTokens(i.items,n));break}default:this.defaults.extensions&&this.defaults.extensions.childTokens&&this.defaults.extensions.childTokens[i.type]?this.defaults.extensions.childTokens[i.type].forEach(s=>{r=r.concat(this.walkTokens(i[s],n))}):i.tokens&&(r=r.concat(this.walkTokens(i.tokens,n)))}return r}use(...e){const n=this.defaults.extensions||{renderers:{},childTokens:{}};return e.forEach(r=>{const i={...r};if(i.async=this.defaults.async||i.async||!1,r.extensions&&(r.extensions.forEach(s=>{if(!s.name)throw new Error("extension name required");if(s.renderer){const a=n.renderers[s.name];a?n.renderers[s.name]=function(...o){let l=s.renderer.apply(this,o);return l===!1&&(l=a.apply(this,o)),l}:n.renderers[s.name]=s.renderer}if(s.tokenizer){if(!s.level||s.level!=="block"&&s.level!=="inline")throw new Error("extension level must be 'block' or 'inline'");n[s.level]?n[s.level].unshift(s.tokenizer):n[s.level]=[s.tokenizer],s.start&&(s.level==="block"?n.startBlock?n.startBlock.push(s.start):n.startBlock=[s.start]:s.level==="inline"&&(n.startInline?n.startInline.push(s.start):n.startInline=[s.start]))}s.childTokens&&(n.childTokens[s.name]=s.childTokens)}),i.extensions=n),r.renderer){const s=this.defaults.renderer||new mm(this.defaults);for(const a in r.renderer){const o=s[a];s[a]=(...l)=>{let c=r.renderer[a].apply(s,l);return c===!1&&(c=o.apply(s,l)),c}}i.renderer=s}if(r.tokenizer){const s=this.defaults.tokenizer||new pm(this.defaults);for(const a in r.tokenizer){const o=s[a];s[a]=(...l)=>{let c=r.tokenizer[a].apply(s,l);return c===!1&&(c=o.apply(s,l)),c}}i.tokenizer=s}if(r.hooks){const s=this.defaults.hooks||new L1;for(const a in r.hooks){const o=s[a];L1.passThroughHooks.has(a)?s[a]=l=>{if(this.defaults.async)return Promise.resolve(r.hooks[a].call(s,l)).then(u=>o.call(s,u));const c=r.hooks[a].call(s,l);return o.call(s,c)}:s[a]=(...l)=>{let c=r.hooks[a].apply(s,l);return c===!1&&(c=o.apply(s,l)),c}}i.hooks=s}if(r.walkTokens){const s=this.defaults.walkTokens;i.walkTokens=function(a){let o=[];return o.push(r.walkTokens.call(this,a)),s&&(o=o.concat(s.call(this,a))),o}}this.defaults={...this.defaults,...i}}),this}setOptions(e){return this.defaults={...this.defaults,...e},this}}Nl=new WeakSet,b4=function(e,n){return(r,i,s)=>{typeof i=="function"&&(s=i,i=null);const a={...i};i={...this.defaults,...a};const o=Pf(this,Nl,JC).call(this,i.silent,i.async,s);if(typeof r>"u"||r===null)return o(new Error("marked(): input parameter is undefined or null"));if(typeof r!="string")return o(new Error("marked(): input parameter is of type "+Object.prototype.toString.call(r)+", string expected"));if(_R(i,s),i.hooks&&(i.hooks.options=i),s){const l=i.highlight;let c;try{i.hooks&&(r=i.hooks.preprocess(r)),c=e(r,i)}catch(h){return o(h)}const u=h=>{let p;if(!h)try{i.walkTokens&&this.walkTokens(c,i.walkTokens),p=n(c,i),i.hooks&&(p=i.hooks.postprocess(p))}catch(m){h=m}return i.highlight=l,h?o(h):s(null,p)};if(!l||l.length<3||(delete i.highlight,!c.length))return u();let d=0;this.walkTokens(c,h=>{h.type==="code"&&(d++,setTimeout(()=>{l(h.text,h.lang,(p,m)=>{if(p)return u(p);m!=null&&m!==h.text&&(h.text=m,h.escaped=!0),d--,d===0&&u()})},0))}),d===0&&u();return}if(i.async)return Promise.resolve(i.hooks?i.hooks.preprocess(r):r).then(l=>e(l,i)).then(l=>i.walkTokens?Promise.all(this.walkTokens(l,i.walkTokens)).then(()=>l):l).then(l=>n(l,i)).then(l=>i.hooks?i.hooks.postprocess(l):l).catch(o);try{i.hooks&&(r=i.hooks.preprocess(r));const l=e(r,i);i.walkTokens&&this.walkTokens(l,i.walkTokens);let c=n(l,i);return i.hooks&&(c=i.hooks.postprocess(c)),c}catch(l){return o(l)}}},JC=function(e,n,r){return i=>{if(i.message+=`
113
- Please report this to https://github.com/markedjs/marked.`,e){const s="<p>An error occurred:</p><pre>"+Dn(i.message+"",!0)+"</pre>";if(n)return Promise.resolve(s);if(r){r(null,s);return}return s}if(n)return Promise.reject(i);if(r){r(i);return}throw i}};const _l=new ER(ko);function ut(t,e,n){return _l.parse(t,e,n)}ut.options=ut.setOptions=function(t){return _l.setOptions(t),ut.defaults=_l.defaults,qC(ut.defaults),ut};ut.getDefaults=rv;ut.defaults=ko;ut.use=function(...t){return _l.use(...t),ut.defaults=_l.defaults,qC(ut.defaults),ut};ut.walkTokens=function(t,e){return _l.walkTokens(t,e)};ut.parseInline=_l.parseInline;ut.Parser=nl;ut.parser=nl.parse;ut.Renderer=mm;ut.TextRenderer=iv;ut.Lexer=ls;ut.lexer=ls.lex;ut.Tokenizer=pm;ut.Slugger=sv;ut.Hooks=L1;ut.parse=ut;ut.options;ut.setOptions;ut.use;ut.walkTokens;ut.parseInline;nl.parse;ls.lex;const Xt=({value:t,...e})=>f.jsx("div",{...e,children:f.jsx("p",{className:"--mdx md-view",dangerouslySetInnerHTML:{__html:ut.parse(t??"",{mangle:!1,headerIds:!1,sanitize:!1})}})}),kR="💡 changes made, don't forget to save",Cs=_.forwardRef(({time:t,changes_made:e=!1,rightText:n="created at: ",...r},i)=>{const[s,a]=_.useState(e),o=t?n+new Date(t).toLocaleString():"*";return _.useEffect(()=>ns.add_sub(l=>{switch(l){case YC:a(!0);return;case WC:return;default:return}}),[ns]),_.useImperativeHandle(i,()=>({get:()=>s,set:(l=!1)=>a(l)}),[s]),f.jsx("div",{...r,children:f.jsxs("div",{className:`relative w-full flex flex-row
113
+ Please report this to https://github.com/markedjs/marked.`,e){const s="<p>An error occurred:</p><pre>"+Dn(i.message+"",!0)+"</pre>";if(n)return Promise.resolve(s);if(r){r(null,s);return}return s}if(n)return Promise.reject(i);if(r){r(i);return}throw i}};const _l=new ER(ko);function ut(t,e,n){return _l.parse(t,e,n)}ut.options=ut.setOptions=function(t){return _l.setOptions(t),ut.defaults=_l.defaults,qC(ut.defaults),ut};ut.getDefaults=rv;ut.defaults=ko;ut.use=function(...t){return _l.use(...t),ut.defaults=_l.defaults,qC(ut.defaults),ut};ut.walkTokens=function(t,e){return _l.walkTokens(t,e)};ut.parseInline=_l.parseInline;ut.Parser=nl;ut.parser=nl.parse;ut.Renderer=mm;ut.TextRenderer=iv;ut.Lexer=ls;ut.lexer=ls.lex;ut.Tokenizer=pm;ut.Slugger=sv;ut.Hooks=L1;ut.parse=ut;ut.options;ut.setOptions;ut.use;ut.walkTokens;ut.parseInline;nl.parse;ls.lex;const Xt=({value:t,...e})=>f.jsx("div",{...e,children:f.jsx("p",{className:"--mdx md-view overflow-auto",dangerouslySetInnerHTML:{__html:ut.parse(t??"",{mangle:!1,headerIds:!1,sanitize:!1})}})}),kR="💡 changes made, don't forget to save",Cs=_.forwardRef(({time:t,changes_made:e=!1,rightText:n="created at: ",...r},i)=>{const[s,a]=_.useState(e),o=t?n+new Date(t).toLocaleString():"*";return _.useEffect(()=>ns.add_sub(l=>{switch(l){case YC:a(!0);return;case WC:return;default:return}}),[ns]),_.useImperativeHandle(i,()=>({get:()=>s,set:(l=!1)=>a(l)}),[s]),f.jsx("div",{...r,children:f.jsxs("div",{className:`relative w-full flex flex-row
114
114
  justify-between items-center`,children:[s&&f.jsx("p",{children:kR,className:`absolute left-0 -top-full shelf-border-color
115
115
  border rounded-md px-1 py-0
116
116
  bg-lime-50/50 text-green-700
@@ -140,7 +140,7 @@ Please report this to https://github.com/markedjs/marked.`,e){const s="<p>An err
140
140
  text-gray-600 dark:text-gray-400
141
141
  text-base font-semibold tracking-tight`,loading:c,onClick:d,...l})}):null},Wn=({from:t,to:e,rounded:n="rounded-lg",stroke:r="border-2",children:i,text:s="what",className:a="h-10",btnClassName:o="",...l})=>f.jsx(ot,{from:t,to:e,rounded:n,stroke:r,className:a,children:f.jsx("button",{className:`h-full w-full align-middle text-center px-3
142
142
  rounded-md shelf-button-color-soft
143
- whitespace-nowrap ${o}`,children:i??s,...l})}),NR=({from:t,to:e,rounded:n="rounded-lg",stroke:r,...i})=>f.jsx(ot,{from:t,to:e,rounded:n,stroke:r,className:"w-fit h-fit",children:f.jsx(TR,{...i})}),ff=({Icon:t,from:e="#973cff",to:n="rgb(236 72 153)",...r})=>{const i=btoa(`gradient_${e}_${n}`);return f.jsxs(f.Fragment,{children:[f.jsx("svg",{width:"0",height:"0",className:"absolute",children:f.jsxs("linearGradient",{id:i,x1:"100%",y1:"100%",x2:"0%",y2:"0%",children:[f.jsx("stop",{stopColor:e,offset:"0%"}),f.jsx("stop",{stopColor:n,offset:"100%"})]})}),f.jsx(t,{style:{fill:`url(#${i})`},...r})]})},tT="3.7.7",AR=tT,pu=typeof Buffer=="function",h8=typeof TextDecoder=="function"?new TextDecoder:void 0,p8=typeof TextEncoder=="function"?new TextEncoder:void 0,DR="ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/=",h1=Array.prototype.slice.call(DR),eh=(t=>{let e={};return t.forEach((n,r)=>e[n]=r),e})(h1),OR=/^(?:[A-Za-z\d+\/]{4})*?(?:[A-Za-z\d+\/]{2}(?:==)?|[A-Za-z\d+\/]{3}=?)?$/,bn=String.fromCharCode.bind(String),m8=typeof Uint8Array.from=="function"?Uint8Array.from.bind(Uint8Array):t=>new Uint8Array(Array.prototype.slice.call(t,0)),nT=t=>t.replace(/=/g,"").replace(/[+\/]/g,e=>e=="+"?"-":"_"),rT=t=>t.replace(/[^A-Za-z0-9\+\/]/g,""),iT=t=>{let e,n,r,i,s="";const a=t.length%3;for(let o=0;o<t.length;){if((n=t.charCodeAt(o++))>255||(r=t.charCodeAt(o++))>255||(i=t.charCodeAt(o++))>255)throw new TypeError("invalid character found");e=n<<16|r<<8|i,s+=h1[e>>18&63]+h1[e>>12&63]+h1[e>>6&63]+h1[e&63]}return a?s.slice(0,a-3)+"===".substring(a):s},av=typeof btoa=="function"?t=>btoa(t):pu?t=>Buffer.from(t,"binary").toString("base64"):iT,w4=pu?t=>Buffer.from(t).toString("base64"):t=>{let n=[];for(let r=0,i=t.length;r<i;r+=4096)n.push(bn.apply(null,t.subarray(r,r+4096)));return av(n.join(""))},up=(t,e=!1)=>e?nT(w4(t)):w4(t),MR=t=>{if(t.length<2){var e=t.charCodeAt(0);return e<128?t:e<2048?bn(192|e>>>6)+bn(128|e&63):bn(224|e>>>12&15)+bn(128|e>>>6&63)+bn(128|e&63)}else{var e=65536+(t.charCodeAt(0)-55296)*1024+(t.charCodeAt(1)-56320);return bn(240|e>>>18&7)+bn(128|e>>>12&63)+bn(128|e>>>6&63)+bn(128|e&63)}},IR=/[\uD800-\uDBFF][\uDC00-\uDFFFF]|[^\x00-\x7F]/g,sT=t=>t.replace(IR,MR),g8=pu?t=>Buffer.from(t,"utf8").toString("base64"):p8?t=>w4(p8.encode(t)):t=>av(sT(t)),Dc=(t,e=!1)=>e?nT(g8(t)):g8(t),y8=t=>Dc(t,!0),LR=/[\xC0-\xDF][\x80-\xBF]|[\xE0-\xEF][\x80-\xBF]{2}|[\xF0-\xF7][\x80-\xBF]{3}/g,PR=t=>{switch(t.length){case 4:var e=(7&t.charCodeAt(0))<<18|(63&t.charCodeAt(1))<<12|(63&t.charCodeAt(2))<<6|63&t.charCodeAt(3),n=e-65536;return bn((n>>>10)+55296)+bn((n&1023)+56320);case 3:return bn((15&t.charCodeAt(0))<<12|(63&t.charCodeAt(1))<<6|63&t.charCodeAt(2));default:return bn((31&t.charCodeAt(0))<<6|63&t.charCodeAt(1))}},aT=t=>t.replace(LR,PR),oT=t=>{if(t=t.replace(/\s+/g,""),!OR.test(t))throw new TypeError("malformed base64.");t+="==".slice(2-(t.length&3));let e,n="",r,i;for(let s=0;s<t.length;)e=eh[t.charAt(s++)]<<18|eh[t.charAt(s++)]<<12|(r=eh[t.charAt(s++)])<<6|(i=eh[t.charAt(s++)]),n+=r===64?bn(e>>16&255):i===64?bn(e>>16&255,e>>8&255):bn(e>>16&255,e>>8&255,e&255);return n},ov=typeof atob=="function"?t=>atob(rT(t)):pu?t=>Buffer.from(t,"base64").toString("binary"):oT,lT=pu?t=>m8(Buffer.from(t,"base64")):t=>m8(ov(t).split("").map(e=>e.charCodeAt(0))),cT=t=>lT(uT(t)),RR=pu?t=>Buffer.from(t,"base64").toString("utf8"):h8?t=>h8.decode(lT(t)):t=>aT(ov(t)),uT=t=>rT(t.replace(/[-_]/g,e=>e=="-"?"+":"/")),E4=t=>RR(uT(t)),jR=t=>{if(typeof t!="string")return!1;const e=t.replace(/\s+/g,"").replace(/={0,2}$/,"");return!/[^\s0-9a-zA-Z\+/]/.test(e)||!/[^\s0-9a-zA-Z\-_]/.test(e)},dT=t=>({value:t,enumerable:!1,writable:!0,configurable:!0}),fT=function(){const t=(e,n)=>Object.defineProperty(String.prototype,e,dT(n));t("fromBase64",function(){return E4(this)}),t("toBase64",function(e){return Dc(this,e)}),t("toBase64URI",function(){return Dc(this,!0)}),t("toBase64URL",function(){return Dc(this,!0)}),t("toUint8Array",function(){return cT(this)})},hT=function(){const t=(e,n)=>Object.defineProperty(Uint8Array.prototype,e,dT(n));t("toBase64",function(e){return up(this,e)}),t("toBase64URI",function(){return up(this,!0)}),t("toBase64URL",function(){return up(this,!0)})},FR=()=>{fT(),hT()},BR={version:tT,VERSION:AR,atob:ov,atobPolyfill:oT,btoa:av,btoaPolyfill:iT,fromBase64:E4,toBase64:Dc,encode:Dc,encodeURI:y8,encodeURL:y8,utob:sT,btou:aT,decode:E4,isValid:jR,fromUint8Array:up,toUint8Array:cT,extendString:fT,extendUint8Array:hT,extendBuiltins:FR},v8=t=>t.toLowerCase().split(" ").join("-"),k4=async()=>{let t;try{t=await navigator.clipboard.readText(),console.log("Content read from clipboard: ",t)}catch(e){console.error("Failed to read: ",e)}return t},C4=async t=>{try{await navigator.clipboard.writeText(t),console.log("Content copied to clipboard")}catch(e){console.error("Failed to copy: ",e)}},pT=()=>"maxTouchPoints"in navigator?navigator.maxTouchPoints>0:!1,HR=t=>JSON.parse(BR.decode(decodeURIComponent(t)));var T0=Sn.GenIcon,zR=function(e){return T0({tag:"svg",attr:{viewBox:"0 0 24 24"},child:[{tag:"path",attr:{d:"M2.00488 4C2.00488 3.44772 2.4526 3 3.00488 3H21.0049C21.5572 3 22.0049 3.44772 22.0049 4V9.5C20.6242 9.5 19.5049 10.6193 19.5049 12C19.5049 13.3807 20.6242 14.5 22.0049 14.5V20C22.0049 20.5523 21.5572 21 21.0049 21H3.00488C2.4526 21 2.00488 20.5523 2.00488 20V4ZM8.09024 19C8.29615 18.4174 8.85177 18 9.50488 18C10.158 18 10.7136 18.4174 10.9195 19H20.0049V16.0322C18.5232 15.2959 17.5049 13.7669 17.5049 12C17.5049 10.2331 18.5232 8.70411 20.0049 7.96776V5H10.9195C10.7136 5.5826 10.158 6 9.50488 6C8.85177 6 8.29615 5.5826 8.09024 5H4.00488V19H8.09024ZM9.50488 11C8.67646 11 8.00488 10.3284 8.00488 9.5C8.00488 8.67157 8.67646 8 9.50488 8C10.3333 8 11.0049 8.67157 11.0049 9.5C11.0049 10.3284 10.3333 11 9.50488 11ZM9.50488 16C8.67646 16 8.00488 15.3284 8.00488 14.5C8.00488 13.6716 8.67646 13 9.50488 13C10.3333 13 11.0049 13.6716 11.0049 14.5C11.0049 15.3284 10.3333 16 9.50488 16Z"}}]})(e)},UR=function(e){return T0({tag:"svg",attr:{viewBox:"0 0 24 24"},child:[{tag:"path",attr:{d:"M20 13C18.3221 13 16.7514 13.4592 15.4068 14.2587C16.5908 15.6438 17.5269 17.2471 18.1465 19H20V13ZM16.0037 19C14.0446 14.3021 9.4079 11 4 11V19H16.0037ZM4 9C7.82914 9 11.3232 10.4348 13.9738 12.7961C15.7047 11.6605 17.7752 11 20 11V3H21.0082C21.556 3 22 3.44495 22 3.9934V20.0066C22 20.5552 21.5447 21 21.0082 21H2.9918C2.44405 21 2 20.5551 2 20.0066V3.9934C2 3.44476 2.45531 3 2.9918 3H6V1H8V5H4V9ZM18 1V5H10V3H16V1H18ZM16.5 10C15.6716 10 15 9.32843 15 8.5C15 7.67157 15.6716 7 16.5 7C17.3284 7 18 7.67157 18 8.5C18 9.32843 17.3284 10 16.5 10Z"}}]})(e)},$R=function(e){return T0({tag:"svg",attr:{viewBox:"0 0 24 24"},child:[{tag:"path",attr:{d:"M3 13H11V3H3V13ZM3 21H11V15H3V21ZM13 21H21V11H13V21ZM13 3V9H21V3H13Z"}}]})(e)},VR=function(e){return T0({tag:"svg",attr:{viewBox:"0 0 24 24"},child:[{tag:"path",attr:{d:"M18 8H20C20.5523 8 21 8.44772 21 9V21C21 21.5523 20.5523 22 20 22H4C3.44772 22 3 21.5523 3 21V9C3 8.44772 3.44772 8 4 8H6V7C6 3.68629 8.68629 1 12 1C15.3137 1 18 3.68629 18 7V8ZM5 10V20H19V10H5ZM11 14H13V16H11V14ZM7 14H9V16H7V14ZM15 14H17V16H15V14ZM16 8V7C16 4.79086 14.2091 3 12 3C9.79086 3 8 4.79086 8 7V8H16Z"}}]})(e)},S0=Sn.GenIcon,YR=function(e){return S0({tag:"svg",attr:{viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"2",strokeLinecap:"round",strokeLinejoin:"round"},child:[{tag:"circle",attr:{cx:"12",cy:"12",r:"10"}},{tag:"line",attr:{x1:"8",y1:"12",x2:"16",y2:"12"}}]})(e)},WR=function(e){return S0({tag:"svg",attr:{viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"2",strokeLinecap:"round",strokeLinejoin:"round"},child:[{tag:"circle",attr:{cx:"12",cy:"12",r:"10"}},{tag:"line",attr:{x1:"12",y1:"8",x2:"12",y2:"16"}},{tag:"line",attr:{x1:"8",y1:"12",x2:"16",y2:"12"}}]})(e)},GR=function(e){return S0({tag:"svg",attr:{viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"2",strokeLinecap:"round",strokeLinejoin:"round"},child:[{tag:"path",attr:{d:"M19 21H5a2 2 0 0 1-2-2V5a2 2 0 0 1 2-2h11l5 5v11a2 2 0 0 1-2 2z"}},{tag:"polyline",attr:{points:"17 21 17 13 7 13 7 21"}},{tag:"polyline",attr:{points:"7 3 7 8 15 8"}}]})(e)},KR=function(e){return S0({tag:"svg",attr:{viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"2",strokeLinecap:"round",strokeLinejoin:"round"},child:[{tag:"circle",attr:{cx:"12",cy:"12",r:"3"}},{tag:"path",attr:{d:"M19.4 15a1.65 1.65 0 0 0 .33 1.82l.06.06a2 2 0 0 1 0 2.83 2 2 0 0 1-2.83 0l-.06-.06a1.65 1.65 0 0 0-1.82-.33 1.65 1.65 0 0 0-1 1.51V21a2 2 0 0 1-2 2 2 2 0 0 1-2-2v-.09A1.65 1.65 0 0 0 9 19.4a1.65 1.65 0 0 0-1.82.33l-.06.06a2 2 0 0 1-2.83 0 2 2 0 0 1 0-2.83l.06-.06a1.65 1.65 0 0 0 .33-1.82 1.65 1.65 0 0 0-1.51-1H3a2 2 0 0 1-2-2 2 2 0 0 1 2-2h.09A1.65 1.65 0 0 0 4.6 9a1.65 1.65 0 0 0-.33-1.82l-.06-.06a2 2 0 0 1 0-2.83 2 2 0 0 1 2.83 0l.06.06a1.65 1.65 0 0 0 1.82.33H9a1.65 1.65 0 0 0 1-1.51V3a2 2 0 0 1 2-2 2 2 0 0 1 2 2v.09a1.65 1.65 0 0 0 1 1.51 1.65 1.65 0 0 0 1.82-.33l.06-.06a2 2 0 0 1 2.83 0 2 2 0 0 1 0 2.83l-.06.06a1.65 1.65 0 0 0-.33 1.82V9a1.65 1.65 0 0 0 1.51 1H21a2 2 0 0 1 2 2 2 2 0 0 1-2 2h-.09a1.65 1.65 0 0 0-1.51 1z"}}]})(e)};const qR="@storecraft/dashboard",QR="1.0.11",ZR="Storecraft Official Dashboard",XR="MIT",JR="Tomer Shalev (https://github.com/store-craft)",ej="https://github.com/store-craft/storecraft",tj={type:"git",url:"https://github.com/store-craft/storecraft.git",directory:"packages/dashboard"},nj=["commerce","dashboard","react","storecraft"],rj="module",ij="./src/index.jsx",sj={".":{import:"./dist/lib/index.js",require:"./dist/lib/index.umd.cjs",types:"./dist/lib/src/index.d.ts"}},aj={start:"npm run dashboard:dev","dashboard:dev":"vite --host","dashboard:build":"vite build && npm run dashboard:lib:build","dashboard:lib:build":"vite build -c vite.lib.config.js","dashboard:lint":"eslint . --ext js,jsx --report-unused-disable-directives --max-warnings 0","dashboard:preview":"vite preview","dashboard:publish":"npm publish --access public","dashboard:analyze":"npx vite-bundle-visualizer -c vite.lib.config.js",prepublishOnly:"npm run dashboard:build"},oj={"@storecraft/core":"^1.0.0","@storecraft/sdk":"^0.1.0","@storecraft/sdk-react-hooks":"^0.1.0","@uiw/react-md-editor":"^3.18.1","@monaco-editor/react":"^4.6.0","monaco-editor":"^0.48.0","chart.js":"^4.2.0",handlebars:"^4.7.8","js-base64":"^3.7.5",marked:"^5.0.2",react:"18.2.0","react-datepicker":"^4.10.0","react-dom":"18.2.0","react-drag-drop-container":"^6.1.1","react-icons":"^4.9.0","react-image-crop":"^10.0.7","react-inspector":"^6.0.1","react-router-dom":"^6.14.1"},lj={"@types/react":"^18.2.66","@types/react-datepicker":"^6.2.0","@types/react-dom":"^18.2.22","@types/react-image-crop":"^8.1.6","@vitejs/plugin-react":"^4.2.1",autoprefixer:"^10.4.19",eslint:"^8.57.0","eslint-plugin-react":"^7.34.1","eslint-plugin-react-hooks":"^4.6.0","eslint-plugin-react-refresh":"^0.4.6",postcss:"^8.4.38","postcss-flexbugs-fixes":"^5.0.2","postcss-import":"^14.1.0","postcss-preset-env":"^7.7.2",sass:"^1.58.3","tailwind-scrollbar":"^2.1.0",tailwindcss:"^3.4.3",vite:"^5.2.0","vite-plugin-css-injected-by-js":"^3.5.1","vite-plugin-dts":"^3.9.1"},cj=["dist"],uj={name:qR,version:QR,description:ZR,license:XR,author:JR,homepage:ej,repository:tj,keywords:nj,type:rj,module:ij,exports:sj,scripts:aj,dependencies:oj,devDependencies:lj,files:cj},dj="data:image/png;base64,iVBORw0KGgo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bFxF5NkSq2JUSc/A2VKJTIK1yXYOLeSOi/s1HAq8DGBQPA68wz7Fm6MpnmTOBXoxlfa3PomqRxKN+OiqNJHR1iC1rk+Jj7ZgArS0FAjFODkNclCsdba4HQWonQKT8xQGf0bC+Vgk2xcOKCGl0IbtsNSzd9Jl/LX7rn18r7hmIKVq0w8oVJuMdqbF5x17aMz0JX3BFOXeZo9yjiLkzcbzkYGFxHMFNaOsRWSIIcV0rMGUOf2X8oRmeDooVJOCO7aGXy5s98AGvWcaILDmueVB7Du13TAOmIsuqqEgmKmCPTUOqIwNaCilesiFXKoNLRZYAZ1Wp/5MIyaYEucevlPArRiEs9PBTG1TRhPbBEH17csHS2878/N8OdnZkZwUMp1zd+bUDO/3qJ8/xOUVarKDYb6ZIzz8QqaElMtF6OOJ3K0xGY8VGoP1nOKhP3Tr6/bG9uThv5ZCJNX//wys+aY0M1tqYWYHEfotBcj6VVRfoLjJLg1p2IXioYVpbRR0aorm3B7LtS+AG5wxIxZqhDKj9jzsWlqNSOyFj4yYtaNbiEMM5unuWQMY5DSUnClUHpZxod26/1R5jNUf3uPuAKD3Zcs0+RCBTaYTEUe03OS/n2qhdwGAjLrWxJ/JUwQ92aODwSFlGJWghoJk4Ir1LFAtFwGmPIy0Wn3bJoueeKzhlQFuzzOYO2NubH1AVph7dFmuP+HUpzipRU6bSOOTyiJgSShZJypoxHrz9ZBQG81NCqLXgl1AJ6YFMWwFWFXxGTULNFpkRVBgeC4ri8UPoAdxwXJO5slbTqbUyNQyQmEwbSVHEZ4lDJBdFZA7NBZ+p/F8f0eDkJ+Qmsbco9kSE64p7YcixLu7Pcu0O0zU7gIpyMRRbooKtux3/CRMitNFcerR3AAAAAElFTkSuQmCC",fj=({children:t,...e})=>f.jsxs("svg",{viewBox:"0 0 302 53",...e,children:[t,f.jsxs("g",{className:"",children:[f.jsx("path",{d:"M 29.756 18.948 C 29.962 17.646 29.691 16.631 28.944 15.903 C 28.196 15.175 26.964 14.811 25.248 14.811 C 24.111 14.811 23.127 14.959 22.296 15.255 C 21.465 15.551 20.795 15.956 20.288 16.471 C 19.781 16.986 19.439 17.575 19.262 18.238 C 19.103 18.783 19.093 19.262 19.232 19.676 C 19.371 20.091 19.636 20.455 20.025 20.768 C 20.414 21.082 20.911 21.357 21.515 21.594 C 21.883 21.738 22.285 21.872 22.72 21.994 L 9.695 21.994 C 9.62 21.043 9.728 19.992 10.02 18.842 C 10.569 16.593 11.665 14.622 13.306 12.929 C 14.947 11.236 16.963 9.917 19.353 8.97 C 21.744 8.023 24.318 7.549 27.076 7.549 C 29.893 7.549 32.222 8.026 34.062 8.979 C 35.901 9.932 37.181 11.266 37.902 12.982 C 38.622 14.699 38.712 16.687 38.172 18.948 Z M 30.923 24.488 C 32.14 25.139 33.106 25.915 33.823 26.814 C 34.346 27.47 34.729 28.199 34.974 29 L 18.016 29 L 17.649 28.909 C 14.68 28.187 12.492 27.018 11.084 25.403 C 10.7 24.963 10.395 24.48 10.167 23.955 L 29.804 23.955 C 30.197 24.122 30.57 24.299 30.923 24.488 Z M 34.951 33.863 C 34.761 34.61 34.519 35.322 34.226 36 L 24.639 36 C 24.716 35.935 24.79 35.867 24.862 35.798 C 25.453 35.23 25.847 34.579 26.042 33.845 C 26.201 33.159 26.135 32.57 25.843 32.079 C 25.593 31.659 25.169 31.286 24.572 30.961 L 35.287 30.961 C 35.313 31.856 35.201 32.823 34.951 33.863 Z M 31.736 39.776 C 30.178 41.421 28.216 42.682 25.849 43.558 C 23.482 44.434 20.783 44.872 17.753 44.872 C 14.711 44.872 12.173 44.416 10.139 43.504 C 8.106 42.593 6.693 41.208 5.902 39.35 C 5.716 38.914 5.571 38.451 5.466 37.961 L 33.173 37.961 C 32.751 38.605 32.273 39.21 31.736 39.776 Z M 5.724 32.301 L 14.14 32.301 C 13.919 33.472 13.989 34.449 14.351 35.23 C 14.481 35.511 14.644 35.768 14.841 36 L 5.261 36 C 5.252 34.877 5.406 33.644 5.724 32.301 Z M 38.769 15.184 L 40.549 8.046 L 71.284 8.046 L 69.504 15.184 L 58.478 15.184 L 56.78 21.994 L 48.115 21.994 L 49.813 15.184 Z M 51.191 44.41 L 42.526 44.41 L 44.134 37.961 L 52.799 37.961 Z M 99.63 26.228 C 99.391 27.187 99.116 28.111 98.806 29 L 89.779 29 C 90.11 28.14 90.399 27.216 90.645 26.228 C 90.844 25.428 90.995 24.671 91.098 23.955 L 100.109 23.955 C 99.984 24.689 99.825 25.447 99.63 26.228 Z M 86.963 42.741 C 83.981 44.185 80.862 44.907 77.607 44.907 C 74.34 44.907 71.58 44.179 69.327 42.723 C 67.525 41.558 66.174 39.971 65.276 37.961 L 93.429 37.961 C 91.516 39.987 89.36 41.58 86.963 42.741 Z M 64.917 26.228 C 65.112 25.447 65.33 24.689 65.572 23.955 L 74.565 23.955 C 74.31 24.671 74.083 25.428 73.884 26.228 C 73.638 27.216 73.466 28.14 73.368 29 L 64.359 29 C 64.492 28.111 64.678 27.187 64.917 26.228 Z M 69.753 16.054 C 71.98 13.273 74.581 11.16 77.557 9.715 C 80.533 8.271 83.655 7.549 86.922 7.549 C 90.177 7.549 92.936 8.271 95.197 9.715 C 97.459 11.16 99.013 13.273 99.858 16.054 C 100.387 17.795 100.555 19.775 100.362 21.994 L 91.258 21.994 C 91.266 21.364 91.226 20.775 91.138 20.227 C 90.877 18.593 90.226 17.356 89.187 16.516 C 88.148 15.675 86.752 15.255 85 15.255 C 83.26 15.255 81.658 15.675 80.194 16.516 C 78.73 17.356 77.46 18.593 76.383 20.227 C 76.022 20.775 75.689 21.364 75.382 21.994 L 66.295 21.994 C 67.207 19.775 68.36 17.795 69.753 16.054 Z M 73.391 32.23 C 73.652 33.863 74.306 35.1 75.351 35.941 C 75.376 35.961 75.401 35.981 75.426 36 L 64.58 36 C 64.175 34.492 64.031 32.813 64.148 30.961 L 73.276 30.961 C 73.288 31.406 73.327 31.829 73.391 32.23 Z M 84.344 35.941 C 85.803 35.1 87.07 33.863 88.146 32.23 C 88.41 31.829 88.659 31.406 88.894 30.961 L 98.04 30.961 C 97.234 32.813 96.254 34.492 95.1 36 L 84.24 36 C 84.275 35.981 84.309 35.961 84.344 35.941 Z M 96.11 44.41 L 97.718 37.961 L 106.507 37.961 L 104.899 44.41 Z M 105.177 8.046 L 120.198 8.046 C 122.921 8.046 125.152 8.534 126.891 9.511 C 128.63 10.488 129.811 11.885 130.436 13.702 C 131.06 15.519 131.062 17.67 130.442 20.156 C 130.283 20.793 130.095 21.406 129.878 21.994 L 120.615 21.994 C 120.922 21.458 121.162 20.845 121.334 20.156 C 121.614 19.031 121.615 18.099 121.338 17.359 C 121.061 16.619 120.52 16.063 119.713 15.69 C 118.906 15.317 117.846 15.131 116.532 15.131 L 112.199 15.131 L 110.488 21.994 L 101.699 21.994 Z M 127.191 26.574 C 126.381 27.499 125.472 28.308 124.465 29 L 99.952 29 L 101.21 23.955 L 109.999 23.955 L 109.729 25.039 L 114.061 25.039 C 115.387 25.039 116.54 24.864 117.521 24.515 C 117.948 24.363 118.342 24.176 118.704 23.955 L 129 23.955 C 128.49 24.906 127.887 25.779 127.191 26.574 Z M 125.347 43.426 L 126.71 37.961 L 152.065 37.961 L 150.457 44.41 L 125.102 44.41 L 125.347 43.426 L 125.638 44.41 L 116.05 44.41 L 114.213 37.961 L 123.732 37.961 Z M 134.168 8.046 L 159.523 8.046 L 157.744 15.184 L 141.178 15.184 L 139.48 21.994 L 130.691 21.994 Z M 112.504 31.963 L 108.002 31.963 L 106.996 36 L 98.207 36 L 99.463 30.961 L 121.663 30.961 L 123.152 36 L 113.654 36 Z M 56.291 23.955 L 55.033 29 L 46.368 29 L 47.626 23.955 Z M 54.544 30.961 L 53.288 36 L 44.623 36 L 45.879 30.961 Z M 127.199 36 L 128.455 30.961 L 137.244 30.961 L 135.987 36 Z M 128.944 29 L 130.202 23.955 L 154.261 23.955 L 153.003 29 Z",sstyle:"fill: rgb(51, 51, 51);"}),f.jsx("path",{d:"M 188.795 19.736 L 185.933 19.736 Q 185.571 17.852 184.575 16.15 Q 183.579 14.448 182.058 13.135 Q 180.536 11.822 178.562 11.061 Q 176.588 10.3 174.234 10.3 Q 170.648 10.3 167.668 12.193 Q 164.689 14.085 162.905 17.744 Q 161.121 21.402 161.121 26.691 Q 161.121 32.015 162.905 35.664 Q 164.689 39.314 167.668 41.197 Q 170.648 43.081 174.234 43.081 Q 176.588 43.081 178.562 42.329 Q 180.536 41.578 182.058 40.265 Q 183.579 38.952 184.575 37.24 Q 185.571 35.529 185.933 33.645 L 188.795 33.645 Q 188.36 36.036 187.174 38.218 Q 185.988 40.4 184.122 42.094 Q 182.257 43.787 179.766 44.765 Q 177.276 45.743 174.234 45.743 Q 169.579 45.743 166.002 43.389 Q 162.425 41.034 160.397 36.751 Q 158.369 32.468 158.369 26.691 Q 158.369 20.913 160.397 16.63 Q 162.425 12.347 166.002 9.992 Q 169.579 7.638 174.234 7.638 Q 177.276 7.638 179.766 8.607 Q 182.257 9.576 184.122 11.269 Q 185.988 12.963 187.174 15.136 Q 188.36 17.309 188.795 19.736 Z M 192.123 45.236 L 192.123 8.145 L 203.823 8.145 Q 207.554 8.145 210.143 9.54 Q 212.733 10.934 214.092 13.406 Q 215.45 15.878 215.45 19.12 Q 215.45 22.326 214.092 24.78 Q 212.733 27.234 210.152 28.61 Q 207.572 29.987 203.859 29.987 L 193.644 29.987 L 193.644 27.379 L 203.787 27.379 Q 206.666 27.379 208.649 26.365 Q 210.632 25.35 211.647 23.494 Q 212.661 21.638 212.661 19.12 Q 212.661 16.585 211.638 14.692 Q 210.614 12.8 208.631 11.749 Q 206.648 10.699 203.75 10.699 L 194.948 10.699 L 194.948 45.236 Z M 207.916 28.465 L 217.044 45.236 L 213.784 45.236 L 204.728 28.465 Z M 218.397 45.236 L 215.445 45.236 L 228.883 8.145 L 231.98 8.145 L 245.418 45.236 L 242.466 45.236 L 230.549 11.785 L 230.332 11.785 Z M 221.385 31.146 L 239.496 31.146 L 239.496 33.718 L 221.385 33.718 Z M 247.05 45.236 L 247.05 8.145 L 268.131 8.145 L 268.131 10.699 L 249.876 10.699 L 249.876 25.387 L 266.429 25.387 L 266.429 27.958 L 249.876 27.958 L 249.876 45.236 Z M 269.583 10.699 L 269.583 8.145 L 296.024 8.145 L 296.024 10.699 L 284.216 10.699 L 284.216 45.236 L 281.391 45.236 L 281.391 10.699 Z",transform:"matrix(0.998892068862915, 0, 0, 1, 0.17177101969718933, 0)",sstyle:"fill: rgb(51, 51, 51);"})]})]}),mT=({className:t})=>f.jsx(fj,{className:"fill-[url(#a)] text-pink-500 "+t,children:f.jsx("defs",{children:f.jsxs("linearGradient",{id:"a",children:[f.jsx("stop",{offset:"0%","stop-color":"rgb(236 72 153)"}),f.jsx("stop",{offset:"100%","stop-color":"rgb(151 60 255)"})]})})}),hj=({...t})=>{const e=({})=>f.jsxs("div",{className:`rounded-lg my-auto b
143
+ whitespace-nowrap ${o}`,children:i??s,...l})}),NR=({from:t,to:e,rounded:n="rounded-lg",stroke:r,...i})=>f.jsx(ot,{from:t,to:e,rounded:n,stroke:r,className:"w-fit h-fit",children:f.jsx(TR,{...i})}),ff=({Icon:t,from:e="#973cff",to:n="rgb(236 72 153)",...r})=>{const i=btoa(`gradient_${e}_${n}`);return f.jsxs(f.Fragment,{children:[f.jsx("svg",{width:"0",height:"0",className:"absolute",children:f.jsxs("linearGradient",{id:i,x1:"100%",y1:"100%",x2:"0%",y2:"0%",children:[f.jsx("stop",{stopColor:e,offset:"0%"}),f.jsx("stop",{stopColor:n,offset:"100%"})]})}),f.jsx(t,{style:{fill:`url(#${i})`},...r})]})},tT="3.7.7",AR=tT,pu=typeof Buffer=="function",h8=typeof TextDecoder=="function"?new TextDecoder:void 0,p8=typeof TextEncoder=="function"?new TextEncoder:void 0,DR="ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/=",h1=Array.prototype.slice.call(DR),eh=(t=>{let e={};return t.forEach((n,r)=>e[n]=r),e})(h1),OR=/^(?:[A-Za-z\d+\/]{4})*?(?:[A-Za-z\d+\/]{2}(?:==)?|[A-Za-z\d+\/]{3}=?)?$/,bn=String.fromCharCode.bind(String),m8=typeof Uint8Array.from=="function"?Uint8Array.from.bind(Uint8Array):t=>new Uint8Array(Array.prototype.slice.call(t,0)),nT=t=>t.replace(/=/g,"").replace(/[+\/]/g,e=>e=="+"?"-":"_"),rT=t=>t.replace(/[^A-Za-z0-9\+\/]/g,""),iT=t=>{let e,n,r,i,s="";const a=t.length%3;for(let o=0;o<t.length;){if((n=t.charCodeAt(o++))>255||(r=t.charCodeAt(o++))>255||(i=t.charCodeAt(o++))>255)throw new TypeError("invalid character found");e=n<<16|r<<8|i,s+=h1[e>>18&63]+h1[e>>12&63]+h1[e>>6&63]+h1[e&63]}return a?s.slice(0,a-3)+"===".substring(a):s},av=typeof btoa=="function"?t=>btoa(t):pu?t=>Buffer.from(t,"binary").toString("base64"):iT,w4=pu?t=>Buffer.from(t).toString("base64"):t=>{let n=[];for(let r=0,i=t.length;r<i;r+=4096)n.push(bn.apply(null,t.subarray(r,r+4096)));return av(n.join(""))},up=(t,e=!1)=>e?nT(w4(t)):w4(t),MR=t=>{if(t.length<2){var e=t.charCodeAt(0);return e<128?t:e<2048?bn(192|e>>>6)+bn(128|e&63):bn(224|e>>>12&15)+bn(128|e>>>6&63)+bn(128|e&63)}else{var e=65536+(t.charCodeAt(0)-55296)*1024+(t.charCodeAt(1)-56320);return bn(240|e>>>18&7)+bn(128|e>>>12&63)+bn(128|e>>>6&63)+bn(128|e&63)}},IR=/[\uD800-\uDBFF][\uDC00-\uDFFFF]|[^\x00-\x7F]/g,sT=t=>t.replace(IR,MR),g8=pu?t=>Buffer.from(t,"utf8").toString("base64"):p8?t=>w4(p8.encode(t)):t=>av(sT(t)),Dc=(t,e=!1)=>e?nT(g8(t)):g8(t),y8=t=>Dc(t,!0),LR=/[\xC0-\xDF][\x80-\xBF]|[\xE0-\xEF][\x80-\xBF]{2}|[\xF0-\xF7][\x80-\xBF]{3}/g,PR=t=>{switch(t.length){case 4:var e=(7&t.charCodeAt(0))<<18|(63&t.charCodeAt(1))<<12|(63&t.charCodeAt(2))<<6|63&t.charCodeAt(3),n=e-65536;return bn((n>>>10)+55296)+bn((n&1023)+56320);case 3:return bn((15&t.charCodeAt(0))<<12|(63&t.charCodeAt(1))<<6|63&t.charCodeAt(2));default:return bn((31&t.charCodeAt(0))<<6|63&t.charCodeAt(1))}},aT=t=>t.replace(LR,PR),oT=t=>{if(t=t.replace(/\s+/g,""),!OR.test(t))throw new TypeError("malformed base64.");t+="==".slice(2-(t.length&3));let e,n="",r,i;for(let s=0;s<t.length;)e=eh[t.charAt(s++)]<<18|eh[t.charAt(s++)]<<12|(r=eh[t.charAt(s++)])<<6|(i=eh[t.charAt(s++)]),n+=r===64?bn(e>>16&255):i===64?bn(e>>16&255,e>>8&255):bn(e>>16&255,e>>8&255,e&255);return n},ov=typeof atob=="function"?t=>atob(rT(t)):pu?t=>Buffer.from(t,"base64").toString("binary"):oT,lT=pu?t=>m8(Buffer.from(t,"base64")):t=>m8(ov(t).split("").map(e=>e.charCodeAt(0))),cT=t=>lT(uT(t)),RR=pu?t=>Buffer.from(t,"base64").toString("utf8"):h8?t=>h8.decode(lT(t)):t=>aT(ov(t)),uT=t=>rT(t.replace(/[-_]/g,e=>e=="-"?"+":"/")),E4=t=>RR(uT(t)),jR=t=>{if(typeof t!="string")return!1;const e=t.replace(/\s+/g,"").replace(/={0,2}$/,"");return!/[^\s0-9a-zA-Z\+/]/.test(e)||!/[^\s0-9a-zA-Z\-_]/.test(e)},dT=t=>({value:t,enumerable:!1,writable:!0,configurable:!0}),fT=function(){const t=(e,n)=>Object.defineProperty(String.prototype,e,dT(n));t("fromBase64",function(){return E4(this)}),t("toBase64",function(e){return Dc(this,e)}),t("toBase64URI",function(){return Dc(this,!0)}),t("toBase64URL",function(){return Dc(this,!0)}),t("toUint8Array",function(){return cT(this)})},hT=function(){const t=(e,n)=>Object.defineProperty(Uint8Array.prototype,e,dT(n));t("toBase64",function(e){return up(this,e)}),t("toBase64URI",function(){return up(this,!0)}),t("toBase64URL",function(){return up(this,!0)})},FR=()=>{fT(),hT()},BR={version:tT,VERSION:AR,atob:ov,atobPolyfill:oT,btoa:av,btoaPolyfill:iT,fromBase64:E4,toBase64:Dc,encode:Dc,encodeURI:y8,encodeURL:y8,utob:sT,btou:aT,decode:E4,isValid:jR,fromUint8Array:up,toUint8Array:cT,extendString:fT,extendUint8Array:hT,extendBuiltins:FR},v8=t=>t.toLowerCase().split(" ").join("-"),k4=async()=>{let t;try{t=await navigator.clipboard.readText(),console.log("Content read from clipboard: ",t)}catch(e){console.error("Failed to read: ",e)}return t},C4=async t=>{try{await navigator.clipboard.writeText(t),console.log("Content copied to clipboard")}catch(e){console.error("Failed to copy: ",e)}},pT=()=>"maxTouchPoints"in navigator?navigator.maxTouchPoints>0:!1,HR=t=>JSON.parse(BR.decode(decodeURIComponent(t)));var T0=Sn.GenIcon,zR=function(e){return T0({tag:"svg",attr:{viewBox:"0 0 24 24"},child:[{tag:"path",attr:{d:"M2.00488 4C2.00488 3.44772 2.4526 3 3.00488 3H21.0049C21.5572 3 22.0049 3.44772 22.0049 4V9.5C20.6242 9.5 19.5049 10.6193 19.5049 12C19.5049 13.3807 20.6242 14.5 22.0049 14.5V20C22.0049 20.5523 21.5572 21 21.0049 21H3.00488C2.4526 21 2.00488 20.5523 2.00488 20V4ZM8.09024 19C8.29615 18.4174 8.85177 18 9.50488 18C10.158 18 10.7136 18.4174 10.9195 19H20.0049V16.0322C18.5232 15.2959 17.5049 13.7669 17.5049 12C17.5049 10.2331 18.5232 8.70411 20.0049 7.96776V5H10.9195C10.7136 5.5826 10.158 6 9.50488 6C8.85177 6 8.29615 5.5826 8.09024 5H4.00488V19H8.09024ZM9.50488 11C8.67646 11 8.00488 10.3284 8.00488 9.5C8.00488 8.67157 8.67646 8 9.50488 8C10.3333 8 11.0049 8.67157 11.0049 9.5C11.0049 10.3284 10.3333 11 9.50488 11ZM9.50488 16C8.67646 16 8.00488 15.3284 8.00488 14.5C8.00488 13.6716 8.67646 13 9.50488 13C10.3333 13 11.0049 13.6716 11.0049 14.5C11.0049 15.3284 10.3333 16 9.50488 16Z"}}]})(e)},UR=function(e){return T0({tag:"svg",attr:{viewBox:"0 0 24 24"},child:[{tag:"path",attr:{d:"M20 13C18.3221 13 16.7514 13.4592 15.4068 14.2587C16.5908 15.6438 17.5269 17.2471 18.1465 19H20V13ZM16.0037 19C14.0446 14.3021 9.4079 11 4 11V19H16.0037ZM4 9C7.82914 9 11.3232 10.4348 13.9738 12.7961C15.7047 11.6605 17.7752 11 20 11V3H21.0082C21.556 3 22 3.44495 22 3.9934V20.0066C22 20.5552 21.5447 21 21.0082 21H2.9918C2.44405 21 2 20.5551 2 20.0066V3.9934C2 3.44476 2.45531 3 2.9918 3H6V1H8V5H4V9ZM18 1V5H10V3H16V1H18ZM16.5 10C15.6716 10 15 9.32843 15 8.5C15 7.67157 15.6716 7 16.5 7C17.3284 7 18 7.67157 18 8.5C18 9.32843 17.3284 10 16.5 10Z"}}]})(e)},$R=function(e){return T0({tag:"svg",attr:{viewBox:"0 0 24 24"},child:[{tag:"path",attr:{d:"M3 13H11V3H3V13ZM3 21H11V15H3V21ZM13 21H21V11H13V21ZM13 3V9H21V3H13Z"}}]})(e)},VR=function(e){return T0({tag:"svg",attr:{viewBox:"0 0 24 24"},child:[{tag:"path",attr:{d:"M18 8H20C20.5523 8 21 8.44772 21 9V21C21 21.5523 20.5523 22 20 22H4C3.44772 22 3 21.5523 3 21V9C3 8.44772 3.44772 8 4 8H6V7C6 3.68629 8.68629 1 12 1C15.3137 1 18 3.68629 18 7V8ZM5 10V20H19V10H5ZM11 14H13V16H11V14ZM7 14H9V16H7V14ZM15 14H17V16H15V14ZM16 8V7C16 4.79086 14.2091 3 12 3C9.79086 3 8 4.79086 8 7V8H16Z"}}]})(e)},S0=Sn.GenIcon,YR=function(e){return S0({tag:"svg",attr:{viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"2",strokeLinecap:"round",strokeLinejoin:"round"},child:[{tag:"circle",attr:{cx:"12",cy:"12",r:"10"}},{tag:"line",attr:{x1:"8",y1:"12",x2:"16",y2:"12"}}]})(e)},WR=function(e){return S0({tag:"svg",attr:{viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"2",strokeLinecap:"round",strokeLinejoin:"round"},child:[{tag:"circle",attr:{cx:"12",cy:"12",r:"10"}},{tag:"line",attr:{x1:"12",y1:"8",x2:"12",y2:"16"}},{tag:"line",attr:{x1:"8",y1:"12",x2:"16",y2:"12"}}]})(e)},GR=function(e){return S0({tag:"svg",attr:{viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"2",strokeLinecap:"round",strokeLinejoin:"round"},child:[{tag:"path",attr:{d:"M19 21H5a2 2 0 0 1-2-2V5a2 2 0 0 1 2-2h11l5 5v11a2 2 0 0 1-2 2z"}},{tag:"polyline",attr:{points:"17 21 17 13 7 13 7 21"}},{tag:"polyline",attr:{points:"7 3 7 8 15 8"}}]})(e)},KR=function(e){return S0({tag:"svg",attr:{viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"2",strokeLinecap:"round",strokeLinejoin:"round"},child:[{tag:"circle",attr:{cx:"12",cy:"12",r:"3"}},{tag:"path",attr:{d:"M19.4 15a1.65 1.65 0 0 0 .33 1.82l.06.06a2 2 0 0 1 0 2.83 2 2 0 0 1-2.83 0l-.06-.06a1.65 1.65 0 0 0-1.82-.33 1.65 1.65 0 0 0-1 1.51V21a2 2 0 0 1-2 2 2 2 0 0 1-2-2v-.09A1.65 1.65 0 0 0 9 19.4a1.65 1.65 0 0 0-1.82.33l-.06.06a2 2 0 0 1-2.83 0 2 2 0 0 1 0-2.83l.06-.06a1.65 1.65 0 0 0 .33-1.82 1.65 1.65 0 0 0-1.51-1H3a2 2 0 0 1-2-2 2 2 0 0 1 2-2h.09A1.65 1.65 0 0 0 4.6 9a1.65 1.65 0 0 0-.33-1.82l-.06-.06a2 2 0 0 1 0-2.83 2 2 0 0 1 2.83 0l.06.06a1.65 1.65 0 0 0 1.82.33H9a1.65 1.65 0 0 0 1-1.51V3a2 2 0 0 1 2-2 2 2 0 0 1 2 2v.09a1.65 1.65 0 0 0 1 1.51 1.65 1.65 0 0 0 1.82-.33l.06-.06a2 2 0 0 1 2.83 0 2 2 0 0 1 0 2.83l-.06.06a1.65 1.65 0 0 0-.33 1.82V9a1.65 1.65 0 0 0 1.51 1H21a2 2 0 0 1 2 2 2 2 0 0 1-2 2h-.09a1.65 1.65 0 0 0-1.51 1z"}}]})(e)};const qR="@storecraft/dashboard",QR="1.0.11",ZR="Storecraft Official Dashboard",XR="MIT",JR="Tomer Shalev (https://github.com/store-craft)",ej="https://github.com/store-craft/storecraft",tj={type:"git",url:"https://github.com/store-craft/storecraft.git",directory:"packages/dashboard"},nj=["commerce","dashboard","react","storecraft"],rj="module",ij="./src/index.jsx",sj={".":{import:"./dist/lib/index.js",require:"./dist/lib/index.umd.cjs",types:"./dist/lib/src/index.d.ts"}},aj={start:"npm run dashboard:dev","dashboard:dev":"vite --host","dashboard:build":"vite build && npm run dashboard:lib:build","dashboard:lib:build":"vite build -c vite.lib.config.js","dashboard:lint":"eslint . --ext js,jsx --report-unused-disable-directives --max-warnings 0","dashboard:preview":"vite preview","dashboard:analyze":"npx vite-bundle-visualizer -c vite.lib.config.js",prepublishOnly:"npm run dashboard:build && npm version patch --force"},oj={"@storecraft/core":"^1.0.0","@storecraft/sdk":"^1.0.0","@storecraft/sdk-react-hooks":"^1.0.0","@uiw/react-md-editor":"^3.18.1","@monaco-editor/react":"^4.6.0","monaco-editor":"^0.48.0","chart.js":"^4.2.0",handlebars:"^4.7.8","js-base64":"^3.7.5",marked:"^5.0.2",react:"18.2.0","react-datepicker":"^4.10.0","react-dom":"18.2.0","react-drag-drop-container":"^6.1.1","react-icons":"^4.9.0","react-image-crop":"^10.0.7","react-inspector":"^6.0.1","react-router-dom":"^6.14.1"},lj={"@types/react":"^18.2.66","@types/react-datepicker":"^6.2.0","@types/react-dom":"^18.2.22","@types/react-image-crop":"^8.1.6","@vitejs/plugin-react":"^4.2.1",autoprefixer:"^10.4.19",eslint:"^8.57.0","eslint-plugin-react":"^7.34.1","eslint-plugin-react-hooks":"^4.6.0","eslint-plugin-react-refresh":"^0.4.6",postcss:"^8.4.38","postcss-flexbugs-fixes":"^5.0.2","postcss-import":"^14.1.0","postcss-preset-env":"^7.7.2",sass:"^1.58.3","tailwind-scrollbar":"^2.1.0",tailwindcss:"^3.4.3",vite:"^5.2.0","vite-plugin-css-injected-by-js":"^3.5.1","vite-plugin-dts":"^3.9.1"},cj=["dist"],uj={name:qR,version:QR,description:ZR,license:XR,author:JR,homepage:ej,repository:tj,keywords:nj,type:rj,module:ij,exports:sj,scripts:aj,dependencies:oj,devDependencies:lj,files:cj},dj="data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAAD4AAAA9CAYAAAD1VdrqAAAAAXNSR0IB2cksfwAAAAlwSFlzAAALEwAACxMBAJqcGAAAGJhJREFUeJzlOwmYXEWZf9V7r+/p6ZmeycxkkplJyIRcJCbhygFyHyqnsKgICyYgsIKurqirn4uCH3gsuwt8uPst64qfLrriwSEYXYEoIkeQKxByTJK5JzM9ffe7X9X+Ve+9np4k4OfuurrZ6unp1/XqVdV/H/W3CkG79sxPX8+rymZFU5KEEIUAvgihgJ8A/hf/AhuXf/71zF1S7yLhHS6bnIeTcCyQYBbO5VzMf4QQxpjHPO64jmtP6Ptr03yIEaqomqpGxJ7EOEVRIpRSRUxBcV4xB6HiM5hNzo7X4gFKVXkfb3jYEk2pN3+w5TvvEvOo4d6ppS2tTjtrOLjhxoK9Ewnk4dvh75BZd3kjsA13yaFP8fA5DgnohIJXhCrP4x3zkKGk4Uvj9eH2xoPLdqJ4YV8dcMIQiRz7SUDOw059MKAHb76x8ZD8DY/VGac+HZ+5U39KXCn4mqsshRG2HXReBNI4mB+0LmmY8G0aAVq/loDfcOqX/tqte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5jNUf3uPuAKD3Zcs0+RCBTaYTEUe03OS/n2qhdwGAjLrWxJ/JUwQ92aODwSFlGJWghoJk4Ir1LFAtFwGmPIy0Wn3bJoueeKzhlQFuzzOYO2NubH1AVph7dFmuP+HUpzipRU6bSOOTyiJgSShZJypoxHrz9ZBQG81NCqLXgl1AJ6YFMWwFWFXxGTULNFpkRVBgeC4ri8UPoAdxwXJO5slbTqbUyNQyQmEwbSVHEZ4lDJBdFZA7NBZ+p/F8f0eDkJ+Qmsbco9kSE64p7YcixLu7Pcu0O0zU7gIpyMRRbooKtux3/CRMitNFcerR3AAAAAElFTkSuQmCC",fj=({children:t,...e})=>f.jsxs("svg",{viewBox:"0 0 302 53",...e,children:[t,f.jsxs("g",{className:"",children:[f.jsx("path",{d:"M 29.756 18.948 C 29.962 17.646 29.691 16.631 28.944 15.903 C 28.196 15.175 26.964 14.811 25.248 14.811 C 24.111 14.811 23.127 14.959 22.296 15.255 C 21.465 15.551 20.795 15.956 20.288 16.471 C 19.781 16.986 19.439 17.575 19.262 18.238 C 19.103 18.783 19.093 19.262 19.232 19.676 C 19.371 20.091 19.636 20.455 20.025 20.768 C 20.414 21.082 20.911 21.357 21.515 21.594 C 21.883 21.738 22.285 21.872 22.72 21.994 L 9.695 21.994 C 9.62 21.043 9.728 19.992 10.02 18.842 C 10.569 16.593 11.665 14.622 13.306 12.929 C 14.947 11.236 16.963 9.917 19.353 8.97 C 21.744 8.023 24.318 7.549 27.076 7.549 C 29.893 7.549 32.222 8.026 34.062 8.979 C 35.901 9.932 37.181 11.266 37.902 12.982 C 38.622 14.699 38.712 16.687 38.172 18.948 Z M 30.923 24.488 C 32.14 25.139 33.106 25.915 33.823 26.814 C 34.346 27.47 34.729 28.199 34.974 29 L 18.016 29 L 17.649 28.909 C 14.68 28.187 12.492 27.018 11.084 25.403 C 10.7 24.963 10.395 24.48 10.167 23.955 L 29.804 23.955 C 30.197 24.122 30.57 24.299 30.923 24.488 Z M 34.951 33.863 C 34.761 34.61 34.519 35.322 34.226 36 L 24.639 36 C 24.716 35.935 24.79 35.867 24.862 35.798 C 25.453 35.23 25.847 34.579 26.042 33.845 C 26.201 33.159 26.135 32.57 25.843 32.079 C 25.593 31.659 25.169 31.286 24.572 30.961 L 35.287 30.961 C 35.313 31.856 35.201 32.823 34.951 33.863 Z M 31.736 39.776 C 30.178 41.421 28.216 42.682 25.849 43.558 C 23.482 44.434 20.783 44.872 17.753 44.872 C 14.711 44.872 12.173 44.416 10.139 43.504 C 8.106 42.593 6.693 41.208 5.902 39.35 C 5.716 38.914 5.571 38.451 5.466 37.961 L 33.173 37.961 C 32.751 38.605 32.273 39.21 31.736 39.776 Z M 5.724 32.301 L 14.14 32.301 C 13.919 33.472 13.989 34.449 14.351 35.23 C 14.481 35.511 14.644 35.768 14.841 36 L 5.261 36 C 5.252 34.877 5.406 33.644 5.724 32.301 Z M 38.769 15.184 L 40.549 8.046 L 71.284 8.046 L 69.504 15.184 L 58.478 15.184 L 56.78 21.994 L 48.115 21.994 L 49.813 15.184 Z M 51.191 44.41 L 42.526 44.41 L 44.134 37.961 L 52.799 37.961 Z M 99.63 26.228 C 99.391 27.187 99.116 28.111 98.806 29 L 89.779 29 C 90.11 28.14 90.399 27.216 90.645 26.228 C 90.844 25.428 90.995 24.671 91.098 23.955 L 100.109 23.955 C 99.984 24.689 99.825 25.447 99.63 26.228 Z M 86.963 42.741 C 83.981 44.185 80.862 44.907 77.607 44.907 C 74.34 44.907 71.58 44.179 69.327 42.723 C 67.525 41.558 66.174 39.971 65.276 37.961 L 93.429 37.961 C 91.516 39.987 89.36 41.58 86.963 42.741 Z M 64.917 26.228 C 65.112 25.447 65.33 24.689 65.572 23.955 L 74.565 23.955 C 74.31 24.671 74.083 25.428 73.884 26.228 C 73.638 27.216 73.466 28.14 73.368 29 L 64.359 29 C 64.492 28.111 64.678 27.187 64.917 26.228 Z M 69.753 16.054 C 71.98 13.273 74.581 11.16 77.557 9.715 C 80.533 8.271 83.655 7.549 86.922 7.549 C 90.177 7.549 92.936 8.271 95.197 9.715 C 97.459 11.16 99.013 13.273 99.858 16.054 C 100.387 17.795 100.555 19.775 100.362 21.994 L 91.258 21.994 C 91.266 21.364 91.226 20.775 91.138 20.227 C 90.877 18.593 90.226 17.356 89.187 16.516 C 88.148 15.675 86.752 15.255 85 15.255 C 83.26 15.255 81.658 15.675 80.194 16.516 C 78.73 17.356 77.46 18.593 76.383 20.227 C 76.022 20.775 75.689 21.364 75.382 21.994 L 66.295 21.994 C 67.207 19.775 68.36 17.795 69.753 16.054 Z M 73.391 32.23 C 73.652 33.863 74.306 35.1 75.351 35.941 C 75.376 35.961 75.401 35.981 75.426 36 L 64.58 36 C 64.175 34.492 64.031 32.813 64.148 30.961 L 73.276 30.961 C 73.288 31.406 73.327 31.829 73.391 32.23 Z M 84.344 35.941 C 85.803 35.1 87.07 33.863 88.146 32.23 C 88.41 31.829 88.659 31.406 88.894 30.961 L 98.04 30.961 C 97.234 32.813 96.254 34.492 95.1 36 L 84.24 36 C 84.275 35.981 84.309 35.961 84.344 35.941 Z M 96.11 44.41 L 97.718 37.961 L 106.507 37.961 L 104.899 44.41 Z M 105.177 8.046 L 120.198 8.046 C 122.921 8.046 125.152 8.534 126.891 9.511 C 128.63 10.488 129.811 11.885 130.436 13.702 C 131.06 15.519 131.062 17.67 130.442 20.156 C 130.283 20.793 130.095 21.406 129.878 21.994 L 120.615 21.994 C 120.922 21.458 121.162 20.845 121.334 20.156 C 121.614 19.031 121.615 18.099 121.338 17.359 C 121.061 16.619 120.52 16.063 119.713 15.69 C 118.906 15.317 117.846 15.131 116.532 15.131 L 112.199 15.131 L 110.488 21.994 L 101.699 21.994 Z M 127.191 26.574 C 126.381 27.499 125.472 28.308 124.465 29 L 99.952 29 L 101.21 23.955 L 109.999 23.955 L 109.729 25.039 L 114.061 25.039 C 115.387 25.039 116.54 24.864 117.521 24.515 C 117.948 24.363 118.342 24.176 118.704 23.955 L 129 23.955 C 128.49 24.906 127.887 25.779 127.191 26.574 Z M 125.347 43.426 L 126.71 37.961 L 152.065 37.961 L 150.457 44.41 L 125.102 44.41 L 125.347 43.426 L 125.638 44.41 L 116.05 44.41 L 114.213 37.961 L 123.732 37.961 Z M 134.168 8.046 L 159.523 8.046 L 157.744 15.184 L 141.178 15.184 L 139.48 21.994 L 130.691 21.994 Z M 112.504 31.963 L 108.002 31.963 L 106.996 36 L 98.207 36 L 99.463 30.961 L 121.663 30.961 L 123.152 36 L 113.654 36 Z M 56.291 23.955 L 55.033 29 L 46.368 29 L 47.626 23.955 Z M 54.544 30.961 L 53.288 36 L 44.623 36 L 45.879 30.961 Z M 127.199 36 L 128.455 30.961 L 137.244 30.961 L 135.987 36 Z M 128.944 29 L 130.202 23.955 L 154.261 23.955 L 153.003 29 Z",sstyle:"fill: rgb(51, 51, 51);"}),f.jsx("path",{d:"M 188.795 19.736 L 185.933 19.736 Q 185.571 17.852 184.575 16.15 Q 183.579 14.448 182.058 13.135 Q 180.536 11.822 178.562 11.061 Q 176.588 10.3 174.234 10.3 Q 170.648 10.3 167.668 12.193 Q 164.689 14.085 162.905 17.744 Q 161.121 21.402 161.121 26.691 Q 161.121 32.015 162.905 35.664 Q 164.689 39.314 167.668 41.197 Q 170.648 43.081 174.234 43.081 Q 176.588 43.081 178.562 42.329 Q 180.536 41.578 182.058 40.265 Q 183.579 38.952 184.575 37.24 Q 185.571 35.529 185.933 33.645 L 188.795 33.645 Q 188.36 36.036 187.174 38.218 Q 185.988 40.4 184.122 42.094 Q 182.257 43.787 179.766 44.765 Q 177.276 45.743 174.234 45.743 Q 169.579 45.743 166.002 43.389 Q 162.425 41.034 160.397 36.751 Q 158.369 32.468 158.369 26.691 Q 158.369 20.913 160.397 16.63 Q 162.425 12.347 166.002 9.992 Q 169.579 7.638 174.234 7.638 Q 177.276 7.638 179.766 8.607 Q 182.257 9.576 184.122 11.269 Q 185.988 12.963 187.174 15.136 Q 188.36 17.309 188.795 19.736 Z M 192.123 45.236 L 192.123 8.145 L 203.823 8.145 Q 207.554 8.145 210.143 9.54 Q 212.733 10.934 214.092 13.406 Q 215.45 15.878 215.45 19.12 Q 215.45 22.326 214.092 24.78 Q 212.733 27.234 210.152 28.61 Q 207.572 29.987 203.859 29.987 L 193.644 29.987 L 193.644 27.379 L 203.787 27.379 Q 206.666 27.379 208.649 26.365 Q 210.632 25.35 211.647 23.494 Q 212.661 21.638 212.661 19.12 Q 212.661 16.585 211.638 14.692 Q 210.614 12.8 208.631 11.749 Q 206.648 10.699 203.75 10.699 L 194.948 10.699 L 194.948 45.236 Z M 207.916 28.465 L 217.044 45.236 L 213.784 45.236 L 204.728 28.465 Z M 218.397 45.236 L 215.445 45.236 L 228.883 8.145 L 231.98 8.145 L 245.418 45.236 L 242.466 45.236 L 230.549 11.785 L 230.332 11.785 Z M 221.385 31.146 L 239.496 31.146 L 239.496 33.718 L 221.385 33.718 Z M 247.05 45.236 L 247.05 8.145 L 268.131 8.145 L 268.131 10.699 L 249.876 10.699 L 249.876 25.387 L 266.429 25.387 L 266.429 27.958 L 249.876 27.958 L 249.876 45.236 Z M 269.583 10.699 L 269.583 8.145 L 296.024 8.145 L 296.024 10.699 L 284.216 10.699 L 284.216 45.236 L 281.391 45.236 L 281.391 10.699 Z",transform:"matrix(0.998892068862915, 0, 0, 1, 0.17177101969718933, 0)",sstyle:"fill: rgb(51, 51, 51);"})]})]}),mT=({className:t})=>f.jsx(fj,{className:"fill-[url(#a)] text-pink-500 "+t,children:f.jsx("defs",{children:f.jsxs("linearGradient",{id:"a",children:[f.jsx("stop",{offset:"0%","stop-color":"rgb(236 72 153)"}),f.jsx("stop",{offset:"100%","stop-color":"rgb(151 60 255)"})]})})}),hj=({...t})=>{const e=({})=>f.jsxs("div",{className:`rounded-lg my-auto b
144
144
  bg-pink-50 dark:bg-pink-50/10 w-fit text-sm
145
145
  text-pink-500 -tracking-wideset
146
146
  py-0 px-1 --border font-semibold`,children:[f.jsx("div",{children:"docs",className:"inline-block -translate-y-px --inline"}),f.jsx("span",{children:" 📖"})]});return f.jsxs("div",{className:`relative w-full h-16 flex flex-row
@@ -170,8 +170,7 @@ Please report this to https://github.com/markedjs/marked.`,e){const s="<p>An err
170
170
  at `+a}return e};Wc.buildMessage=function(t,e){var n={literal:function(c){return'"'+i(c.text)+'"'},class:function(c){var u=c.parts.map(function(d){return Array.isArray(d)?s(d[0])+"-"+s(d[1]):s(d)});return"["+(c.inverted?"^":"")+u.join("")+"]"},any:function(){return"any character"},end:function(){return"end of input"},other:function(c){return c.description}};function r(c){return c.charCodeAt(0).toString(16).toUpperCase()}function i(c){return c.replace(/\\/g,"\\\\").replace(/"/g,'\\"').replace(/\0/g,"\\0").replace(/\t/g,"\\t").replace(/\n/g,"\\n").replace(/\r/g,"\\r").replace(/[\x00-\x0F]/g,function(u){return"\\x0"+r(u)}).replace(/[\x10-\x1F\x7F-\x9F]/g,function(u){return"\\x"+r(u)})}function s(c){return c.replace(/\\/g,"\\\\").replace(/\]/g,"\\]").replace(/\^/g,"\\^").replace(/-/g,"\\-").replace(/\0/g,"\\0").replace(/\t/g,"\\t").replace(/\n/g,"\\n").replace(/\r/g,"\\r").replace(/[\x00-\x0F]/g,function(u){return"\\x0"+r(u)}).replace(/[\x10-\x1F\x7F-\x9F]/g,function(u){return"\\x"+r(u)})}function a(c){return n[c.type](c)}function o(c){var u=c.map(a),d,h;if(u.sort(),u.length>0){for(d=1,h=1;d<u.length;d++)u[d-1]!==u[d]&&(u[h]=u[d],h++);u.length=h}switch(u.length){case 1:return u[0];case 2:return u[0]+" or "+u[1];default:return u.slice(0,-1).join(", ")+", or "+u[u.length-1]}}function l(c){return c?'"'+i(c)+'"':"end of input"}return"Expected "+o(t)+" but "+l(e)+" found."};function wj(t,e){e=e!==void 0?e:{};var n={},r=e.grammarSource,i={expression:Hn},s=Hn,a="|",o="-",l="(",c=")",u="'",d='"',h=/^[^"' ()|&]/,p=/^[^']/,m=/^[^"]/,g=/^[ ]/,y=je("expression"),v=je("sum term"),x=gn("|",!1),b=je("product term"),w=gn("&",!1),C=je("subexpression"),S=gn("-",!1),k=je("term"),N=gn("(",!1),D=gn(")",!1),A=je("variable"),L=Xn(['"',"'"," ","(",")","|","&"],!0,!1),$=je("variable 1"),K=gn("'",!1),X=Xn(["'"],!0,!1),H=gn('"',!1),U=Xn(['"'],!0,!1),G=je("whitespace character(s)"),R=Xn([" "],!1,!1),z=function(Y,te){return _8("|",Y,te)},O=function(Y,te){return _8("&",Y,te)},W=function(Y){return{op:"!",args:[Y]}},Z=function(Y){return Y.group=!0,Y},I=function(Y){return{op:"LEAF",value:zr().trim()}},ie=function(Y){return{op:"LEAF",value:zr().trim().slice(1,-1)}},V=0,ce=0,Ae=[{line:1,column:1}],_e=0,Ne=[],ye=0,$t;if("startRule"in e){if(!(e.startRule in i))throw new Error(`Can't start parsing from rule "`+e.startRule+'".');s=i[e.startRule]}function zr(){return t.substring(ce,V)}function gn(Y,te){return{type:"literal",text:Y,ignoreCase:te}}function Xn(Y,te,ue){return{type:"class",parts:Y,inverted:te,ignoreCase:ue}}function Ki(){return{type:"end"}}function je(Y){return{type:"other",description:Y}}function Ur(Y){var te=Ae[Y],ue;if(te)return te;for(ue=Y-1;!Ae[ue];)ue--;for(te=Ae[ue],te={line:te.line,column:te.column};ue<Y;)t.charCodeAt(ue)===10?(te.line++,te.column=1):te.column++,ue++;return Ae[Y]=te,te}function yn(Y,te,ue){var nt=Ur(Y),Xe=Ur(te),vi={source:r,start:{offset:Y,line:nt.line,column:nt.column},end:{offset:te,line:Xe.line,column:Xe.column}};return vi}function ze(Y){V<_e||(V>_e&&(_e=V,Ne=[]),Ne.push(Y))}function Bn(Y,te,ue){return new Wc(Wc.buildMessage(Y,te),Y,te,ue)}function Hn(){var Y;return ye++,Y=Io(),ye--,Y===n&&ye===0&&ze(y),Y}function Io(){var Y,te,ue,nt;return ye++,Y=V,te=va(),te!==n?(t.charCodeAt(V)===124?(ue=a,V++):(ue=n,ye===0&&ze(x)),ue!==n?(nt=Io(),nt!==n?(ce=Y,Y=z(te,nt)):(V=Y,Y=n)):(V=Y,Y=n)):(V=Y,Y=n),Y===n&&(Y=va()),ye--,Y===n&&(te=n,ye===0&&ze(v)),Y}function va(){var Y,te,ue;return ye++,Y=V,te=xa(),te!==n?(t.charCodeAt(V)===38?V++:ye===0&&ze(w),ue=va(),ue!==n?(ce=Y,Y=O(te,ue)):(V=Y,Y=n)):(V=Y,Y=n),Y===n&&(Y=xa()),ye--,Y===n&&(te=n,ye===0&&ze(b)),Y}function xa(){var Y,te,ue;return ye++,Y=V,ne(),t.charCodeAt(V)===45?(te=o,V++):(te=n,ye===0&&ze(S)),te!==n?(ue=Lo(),ue!==n?(ne(),ce=Y,Y=W(ue)):(V=Y,Y=n)):(V=Y,Y=n),Y===n&&(Y=Lo()),ye--,Y===n&&ye===0&&ze(C),Y}function Lo(){var Y,te,ue,nt;return ye++,Y=q(),Y===n&&(Y=zl()),Y===n&&(Y=V,ne(),t.charCodeAt(V)===40?(te=l,V++):(te=n,ye===0&&ze(N)),te!==n?(ue=Hn(),ue!==n?(t.charCodeAt(V)===41?(nt=c,V++):(nt=n,ye===0&&ze(D)),nt!==n?(ne(),ce=Y,Y=Z(ue)):(V=Y,Y=n)):(V=Y,Y=n)):(V=Y,Y=n)),ye--,Y===n&&ye===0&&ze(k),Y}function zl(){var Y,te,ue;if(ye++,Y=V,ne(),te=[],h.test(t.charAt(V))?(ue=t.charAt(V),V++):(ue=n,ye===0&&ze(L)),ue!==n)for(;ue!==n;)te.push(ue),h.test(t.charAt(V))?(ue=t.charAt(V),V++):(ue=n,ye===0&&ze(L));else te=n;return te!==n?(ue=ne(),ce=Y,Y=I()):(V=Y,Y=n),ye--,Y===n&&ye===0&&ze(A),Y}function q(){var Y,te,ue,nt,Xe;if(ye++,Y=V,ne(),te=V,t.charCodeAt(V)===39?(ue=u,V++):(ue=n,ye===0&&ze(K)),ue!==n){if(nt=[],p.test(t.charAt(V))?(Xe=t.charAt(V),V++):(Xe=n,ye===0&&ze(X)),Xe!==n)for(;Xe!==n;)nt.push(Xe),p.test(t.charAt(V))?(Xe=t.charAt(V),V++):(Xe=n,ye===0&&ze(X));else nt=n;nt!==n?(t.charCodeAt(V)===39?(Xe=u,V++):(Xe=n,ye===0&&ze(K)),Xe!==n?(ue=[ue,nt,Xe],te=ue):(V=te,te=n)):(V=te,te=n)}else V=te,te=n;if(te===n)if(te=V,t.charCodeAt(V)===34?(ue=d,V++):(ue=n,ye===0&&ze(H)),ue!==n){if(nt=[],m.test(t.charAt(V))?(Xe=t.charAt(V),V++):(Xe=n,ye===0&&ze(U)),Xe!==n)for(;Xe!==n;)nt.push(Xe),m.test(t.charAt(V))?(Xe=t.charAt(V),V++):(Xe=n,ye===0&&ze(U));else nt=n;nt!==n?(t.charCodeAt(V)===34?(Xe=d,V++):(Xe=n,ye===0&&ze(H)),Xe!==n?(ue=[ue,nt,Xe],te=ue):(V=te,te=n)):(V=te,te=n)}else V=te,te=n;return te!==n?(ue=ne(),ce=Y,Y=ie()):(V=Y,Y=n),ye--,Y===n&&ye===0&&ze($),Y}function ne(){var Y,te;for(ye++,Y=[],g.test(t.charAt(V))?(te=t.charAt(V),V++):(te=n,ye===0&&ze(R));te!==n;)Y.push(te),g.test(t.charAt(V))?(te=t.charAt(V),V++):(te=n,ye===0&&ze(R));return ye--,te=n,ye===0&&ze(G),Y}if($t=s(),$t!==n&&V===t.length)return $t;throw $t!==n&&V<t.length&&ze(Ki()),Bn(Ne,_e<t.length?t.charAt(_e):null,_e<t.length?yn(_e,_e+1):yn(_e,_e))}class Ej extends Error{constructor(e,n=400){super(JSON.stringify(e,null,2)),this.code=n,this.message=e;try{this.message_string=JSON.stringify(this.message,null,2)}catch{this.message_string=":("}}toString(){return this.message_string}}const th=(t,e,n=400)=>{if(!t)throw new Ej([{message:e}],n)},kj=(t,e="-")=>{if(typeof t!="string")return;let n=t.trim();if(n!==""&&(n=n.toLowerCase().match(/[\p{L}\d]+/gu).join(e),n.length!=0))return n},gT="sortBy",yT="order",T4="limit",S4="limitToLast",N4="vql",vT="startAt",xT="startAfter",_T="endAt",bT="endBefore",wT="expand",nh=(t="")=>{if(!t)return;const e=/(^[^\w]+)/g,n=/([^\w]+$)/g;let r=t.match(e),i=t.match(n),s=t.substring((r==null?void 0:r[0].length)??0);if(s=s.substring(0,s.length-((i==null?void 0:i[0].length)??0)),s!=="")return s.split(",").map(a=>{const o=a.split(":");return[o[0].trim(),o.slice(1).join(":").trim()]})},Cj=(t,e=["*"])=>{var n,r;return((r=(n=t.get(wT))==null?void 0:n.replace(/[()]/g,"").split(","))==null?void 0:r.map(i=>i.trim()).filter(Boolean))??e},Tj=t=>(t??"(updated_at, id)").replace(/[()]/g,"").split(",").map(e=>e.trim()).filter(Boolean),Sj=(t="desc")=>t==="asc"?"asc":"desc",Nj=t=>{t=t instanceof URLSearchParams?t:new URLSearchParams(t);const e={};e.expand=Cj(t),e.limit=parseInt(t.get(T4))?Math.abs(parseInt(t.get(T4))):void 0,e.limitToLast=parseInt(t.get(S4))?Math.abs(parseInt(t.get(S4))):void 0,!e.limitToLast&&!e.limit&&(e.limit=5);try{const a=t.get(N4);a&&(e.vqlParsed=wj(a))}catch(a){console.log(a),th(!1,"VQL parsing failed",401)}e.vql=t.get(N4),e.startAt=nh(t.get(vT)),e.startAfter=nh(t.get(xT)),th(!(e.startAt&&e.startAfter),"Cannot set both startAt and startAfter",401),e.endAt=nh(t.get(_T)),e.endBefore=nh(t.get(bT)),th(!(e.endAt&&e.endBefore),"Cannot set both endAt and endAfter",401);const n=e.startAt||e.startAfter,r=e.endAt||e.endBefore,i=((n==null?void 0:n.length)??0)<((r==null?void 0:r.length)??0)?n:r,s=i===n?r:n;if(n&&r)for(let a=0;a<i.length;a++){const o=i[a][0],l=s[a][0];th(o===l,`non matching keys \`${o}\`!==\`${l}\` in range cursors`,401)}return e.sortBy=Tj(t.get(gT)),e.order=Sj(t.get(yT)),s&&(s!=null&&s.length)&&(e.sortBy=s.map(([a,o],l)=>a)),e},A4=t=>"("+t.join(",")+")",Aj=t=>{const e=t.map(n=>`${n[0]}:${n[1]}`);return A4(e)},cs=t=>{const e=new URLSearchParams;return t.order=(t==null?void 0:t.order)??"desc",t.sortBy=(t==null?void 0:t.sortBy)??["updated_at","id"],t.expand=(t==null?void 0:t.expand)??["*"],!t.limit&&!t.limitToLast&&(t.limit=5),[{cursor:t.endAt,key:_T},{cursor:t.endBefore,key:bT},{cursor:t.startAt,key:vT},{cursor:t.startAfter,key:xT}].filter(n=>{var r;return!!n.cursor&&((r=n.cursor)==null?void 0:r.length)}).forEach(n=>{e.set(n.key,Aj(n.cursor))}),e.set(yT,t.order),e.set(gT,A4(t.sortBy)),e.set(wT,A4(t.expand)),t.vql&&e.set(N4,t.vql),t.limit&&e.set(T4,t.limit.toString()),t.limitToLast&&e.set(S4,t.limitToLast.toString()),e},b8=t=>{if(typeof t!="string")return;let e=t.trim();if(e!==""&&(e=e.toLowerCase().match(/[\p{L}\d]+/gu).join("-"),e.length!=0))return e},Dj=(t,e)=>{if(!t)throw e},p1=(t,e)=>{var r;let n=(r=t==null?void 0:t.endpoint)==null?void 0:r.trim();return n=n!=null&&n.endsWith("/")?n.slice(0,-1):n,e=e!=null&&e.startsWith("/")?e.slice(1):e,n?`${n}/api/${e}`:`/api/${e}`},Ia=async(t,e,n={})=>{const r=await t.auth.working_auth_token(),i=(t.auth.authStrategy==="apikey"?"Basic":"Bearer")+` ${r}`;return await fetch(p1(t.config,e),{...n,headers:{...(n==null?void 0:n.headers)??{},Authorization:i}})},tn=async(t,e,n={})=>{const r=await Ia(t,e,n),i=r.ok;let s;try{s=await r.json()}catch(a){console.log("fetchApiWithAuth.json()",a)}if(!i)throw s;return s};async function Qo(t,e,n){return tn(t,`${e}/${n}`,{method:"get"})}async function ET(t,e,n){return tn(t,`${e}`,{method:"post",body:JSON.stringify(n),headers:{"Content-Type":"application/json"}})}async function lv(t,e,n){return tn(t,`${e}/${n}`,{method:"delete"})}async function N0(t,e,n={}){const r=cs(n);return tn(t,`${e}?${r.toString()}`,{method:"get"})}var Jd,ef;class Rr{constructor(e,n){$r(this,Jd);$r(this,ef);_a(this,Jd,e),_a(this,ef,n)}async get(e){return Qo(this.sdk,this.base_name,e)}async upsert(e){return ET(this.sdk,this.base_name,e)}async remove(e){return lv(this.sdk,this.base_name,e)}async list(e){return N0(this.sdk,this.base_name,e)}get base_name(){return ct(this,ef)}get sdk(){return ct(this,Jd)}}Jd=new WeakMap,ef=new WeakMap;typeof TextDecoder=="function"&&new TextDecoder;typeof TextEncoder=="function"&&new TextEncoder;const Oj="ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/=",Mj=Array.prototype.slice.call(Oj);(t=>{let e={};return t.forEach((n,r)=>e[n]=r),e})(Mj);String.fromCharCode.bind(String);typeof Uint8Array.from=="function"&&Uint8Array.from.bind(Uint8Array);var Je;(function(t){t.assertEqual=i=>i;function e(i){}t.assertIs=e;function n(i){throw new Error}t.assertNever=n,t.arrayToEnum=i=>{const s={};for(const a of i)s[a]=a;return s},t.getValidEnumValues=i=>{const s=t.objectKeys(i).filter(o=>typeof i[i[o]]!="number"),a={};for(const o of s)a[o]=i[o];return t.objectValues(a)},t.objectValues=i=>t.objectKeys(i).map(function(s){return i[s]}),t.objectKeys=typeof Object.keys=="function"?i=>Object.keys(i):i=>{const s=[];for(const a in i)Object.prototype.hasOwnProperty.call(i,a)&&s.push(a);return s},t.find=(i,s)=>{for(const a of i)if(s(a))return a},t.isInteger=typeof Number.isInteger=="function"?i=>Number.isInteger(i):i=>typeof i=="number"&&isFinite(i)&&Math.floor(i)===i;function r(i,s=" | "){return i.map(a=>typeof a=="string"?`'${a}'`:a).join(s)}t.joinValues=r,t.jsonStringifyReplacer=(i,s)=>typeof s=="bigint"?s.toString():s})(Je||(Je={}));var D4;(function(t){t.mergeShapes=(e,n)=>({...e,...n})})(D4||(D4={}));const ve=Je.arrayToEnum(["string","nan","number","integer","float","boolean","date","bigint","symbol","function","undefined","null","array","object","unknown","promise","void","never","map","set"]),Fa=t=>{switch(typeof t){case"undefined":return ve.undefined;case"string":return ve.string;case"number":return isNaN(t)?ve.nan:ve.number;case"boolean":return ve.boolean;case"function":return ve.function;case"bigint":return ve.bigint;case"symbol":return ve.symbol;case"object":return Array.isArray(t)?ve.array:t===null?ve.null:t.then&&typeof t.then=="function"&&t.catch&&typeof t.catch=="function"?ve.promise:typeof Map<"u"&&t instanceof Map?ve.map:typeof Set<"u"&&t instanceof Set?ve.set:typeof Date<"u"&&t instanceof Date?ve.date:ve.object;default:return ve.unknown}},se=Je.arrayToEnum(["invalid_type","invalid_literal","custom","invalid_union","invalid_union_discriminator","invalid_enum_value","unrecognized_keys","invalid_arguments","invalid_return_type","invalid_date","invalid_string","too_small","too_big","invalid_intersection_types","not_multiple_of","not_finite"]),Ij=t=>JSON.stringify(t,null,2).replace(/"([^"]+)":/g,"$1:");class Nr extends Error{constructor(e){super(),this.issues=[],this.addIssue=r=>{this.issues=[...this.issues,r]},this.addIssues=(r=[])=>{this.issues=[...this.issues,...r]};const n=new.target.prototype;Object.setPrototypeOf?Object.setPrototypeOf(this,n):this.__proto__=n,this.name="ZodError",this.issues=e}get errors(){return this.issues}format(e){const n=e||function(s){return s.message},r={_errors:[]},i=s=>{for(const a of s.issues)if(a.code==="invalid_union")a.unionErrors.map(i);else if(a.code==="invalid_return_type")i(a.returnTypeError);else if(a.code==="invalid_arguments")i(a.argumentsError);else if(a.path.length===0)r._errors.push(n(a));else{let o=r,l=0;for(;l<a.path.length;){const c=a.path[l];l===a.path.length-1?(o[c]=o[c]||{_errors:[]},o[c]._errors.push(n(a))):o[c]=o[c]||{_errors:[]},o=o[c],l++}}};return i(this),r}static assert(e){if(!(e instanceof Nr))throw new Error(`Not a ZodError: ${e}`)}toString(){return this.message}get message(){return JSON.stringify(this.issues,Je.jsonStringifyReplacer,2)}get isEmpty(){return this.issues.length===0}flatten(e=n=>n.message){const n={},r=[];for(const i of this.issues)i.path.length>0?(n[i.path[0]]=n[i.path[0]]||[],n[i.path[0]].push(e(i))):r.push(e(i));return{formErrors:r,fieldErrors:n}}get formErrors(){return this.flatten()}}Nr.create=t=>new Nr(t);const Gc=(t,e)=>{let n;switch(t.code){case se.invalid_type:t.received===ve.undefined?n="Required":n=`Expected ${t.expected}, received ${t.received}`;break;case se.invalid_literal:n=`Invalid literal value, expected ${JSON.stringify(t.expected,Je.jsonStringifyReplacer)}`;break;case se.unrecognized_keys:n=`Unrecognized key(s) in object: ${Je.joinValues(t.keys,", ")}`;break;case se.invalid_union:n="Invalid input";break;case se.invalid_union_discriminator:n=`Invalid discriminator value. Expected ${Je.joinValues(t.options)}`;break;case se.invalid_enum_value:n=`Invalid enum value. Expected ${Je.joinValues(t.options)}, received '${t.received}'`;break;case se.invalid_arguments:n="Invalid function arguments";break;case se.invalid_return_type:n="Invalid function return type";break;case se.invalid_date:n="Invalid date";break;case se.invalid_string:typeof t.validation=="object"?"includes"in t.validation?(n=`Invalid input: must include "${t.validation.includes}"`,typeof t.validation.position=="number"&&(n=`${n} at one or more positions greater than or equal to ${t.validation.position}`)):"startsWith"in t.validation?n=`Invalid input: must start with "${t.validation.startsWith}"`:"endsWith"in t.validation?n=`Invalid input: must end with "${t.validation.endsWith}"`:Je.assertNever(t.validation):t.validation!=="regex"?n=`Invalid ${t.validation}`:n="Invalid";break;case se.too_small:t.type==="array"?n=`Array must contain ${t.exact?"exactly":t.inclusive?"at least":"more than"} ${t.minimum} element(s)`:t.type==="string"?n=`String must contain ${t.exact?"exactly":t.inclusive?"at least":"over"} ${t.minimum} character(s)`:t.type==="number"?n=`Number must be ${t.exact?"exactly equal to ":t.inclusive?"greater than or equal to ":"greater than "}${t.minimum}`:t.type==="date"?n=`Date must be ${t.exact?"exactly equal to ":t.inclusive?"greater than or equal to ":"greater than "}${new Date(Number(t.minimum))}`:n="Invalid input";break;case se.too_big:t.type==="array"?n=`Array must contain ${t.exact?"exactly":t.inclusive?"at most":"less than"} ${t.maximum} element(s)`:t.type==="string"?n=`String must contain ${t.exact?"exactly":t.inclusive?"at most":"under"} ${t.maximum} character(s)`:t.type==="number"?n=`Number must be ${t.exact?"exactly":t.inclusive?"less than or equal to":"less than"} ${t.maximum}`:t.type==="bigint"?n=`BigInt must be ${t.exact?"exactly":t.inclusive?"less than or equal to":"less than"} ${t.maximum}`:t.type==="date"?n=`Date must be ${t.exact?"exactly":t.inclusive?"smaller than or equal to":"smaller than"} ${new Date(Number(t.maximum))}`:n="Invalid input";break;case se.custom:n="Invalid input";break;case se.invalid_intersection_types:n="Intersection results could not be merged";break;case se.not_multiple_of:n=`Number must be a multiple of ${t.multipleOf}`;break;case se.not_finite:n="Number must be finite";break;default:n=e.defaultError,Je.assertNever(t)}return{message:n}};let kT=Gc;function Lj(t){kT=t}function gm(){return kT}const ym=t=>{const{data:e,path:n,errorMaps:r,issueData:i}=t,s=[...n,...i.path||[]],a={...i,path:s};if(i.message!==void 0)return{...i,path:s,message:i.message};let o="";const l=r.filter(c=>!!c).slice().reverse();for(const c of l)o=c(a,{data:e,defaultError:o}).message;return{...i,path:s,message:o}},Pj=[];function pe(t,e){const n=gm(),r=ym({issueData:e,data:t.data,path:t.path,errorMaps:[t.common.contextualErrorMap,t.schemaErrorMap,n,n===Gc?void 0:Gc].filter(i=>!!i)});t.common.issues.push(r)}class Rn{constructor(){this.value="valid"}dirty(){this.value==="valid"&&(this.value="dirty")}abort(){this.value!=="aborted"&&(this.value="aborted")}static mergeArray(e,n){const r=[];for(const i of n){if(i.status==="aborted")return Oe;i.status==="dirty"&&e.dirty(),r.push(i.value)}return{status:e.value,value:r}}static async mergeObjectAsync(e,n){const r=[];for(const i of n){const s=await i.key,a=await i.value;r.push({key:s,value:a})}return Rn.mergeObjectSync(e,r)}static mergeObjectSync(e,n){const r={};for(const i of n){const{key:s,value:a}=i;if(s.status==="aborted"||a.status==="aborted")return Oe;s.status==="dirty"&&e.dirty(),a.status==="dirty"&&e.dirty(),s.value!=="__proto__"&&(typeof a.value<"u"||i.alwaysSet)&&(r[s.value]=a.value)}return{status:e.value,value:r}}}const Oe=Object.freeze({status:"aborted"}),gc=t=>({status:"dirty",value:t}),Gn=t=>({status:"valid",value:t}),O4=t=>t.status==="aborted",M4=t=>t.status==="dirty",_d=t=>t.status==="valid",bd=t=>typeof Promise<"u"&&t instanceof Promise;function vm(t,e,n,r){if(typeof e=="function"?t!==e||!r:!e.has(t))throw new TypeError("Cannot read private member from an object whose class did not declare it");return e.get(t)}function CT(t,e,n,r,i){if(typeof e=="function"?t!==e||!i:!e.has(t))throw new TypeError("Cannot write private member to an object whose class did not declare it");return e.set(t,n),n}var ke;(function(t){t.errToObj=e=>typeof e=="string"?{message:e}:e||{},t.toString=e=>typeof e=="string"?e:e==null?void 0:e.message})(ke||(ke={}));var m1,g1;class bs{constructor(e,n,r,i){this._cachedPath=[],this.parent=e,this.data=n,this._path=r,this._key=i}get path(){return this._cachedPath.length||(this._key instanceof Array?this._cachedPath.push(...this._path,...this._key):this._cachedPath.push(...this._path,this._key)),this._cachedPath}}const w8=(t,e)=>{if(_d(e))return{success:!0,data:e.value};if(!t.common.issues.length)throw new Error("Validation failed but no issues detected.");return{success:!1,get error(){if(this._error)return this._error;const n=new Nr(t.common.issues);return this._error=n,this._error}}};function Re(t){if(!t)return{};const{errorMap:e,invalid_type_error:n,required_error:r,description:i}=t;if(e&&(n||r))throw new Error(`Can't use "invalid_type_error" or "required_error" in conjunction with custom error map.`);return e?{errorMap:e,description:i}:{errorMap:(a,o)=>{var l,c;const{message:u}=t;return a.code==="invalid_enum_value"?{message:u??o.defaultError}:typeof o.data>"u"?{message:(l=u??r)!==null&&l!==void 0?l:o.defaultError}:a.code!=="invalid_type"?{message:o.defaultError}:{message:(c=u??n)!==null&&c!==void 0?c:o.defaultError}},description:i}}class Fe{constructor(e){this.spa=this.safeParseAsync,this._def=e,this.parse=this.parse.bind(this),this.safeParse=this.safeParse.bind(this),this.parseAsync=this.parseAsync.bind(this),this.safeParseAsync=this.safeParseAsync.bind(this),this.spa=this.spa.bind(this),this.refine=this.refine.bind(this),this.refinement=this.refinement.bind(this),this.superRefine=this.superRefine.bind(this),this.optional=this.optional.bind(this),this.nullable=this.nullable.bind(this),this.nullish=this.nullish.bind(this),this.array=this.array.bind(this),this.promise=this.promise.bind(this),this.or=this.or.bind(this),this.and=this.and.bind(this),this.transform=this.transform.bind(this),this.brand=this.brand.bind(this),this.default=this.default.bind(this),this.catch=this.catch.bind(this),this.describe=this.describe.bind(this),this.pipe=this.pipe.bind(this),this.readonly=this.readonly.bind(this),this.isNullable=this.isNullable.bind(this),this.isOptional=this.isOptional.bind(this)}get description(){return this._def.description}_getType(e){return Fa(e.data)}_getOrReturnCtx(e,n){return n||{common:e.parent.common,data:e.data,parsedType:Fa(e.data),schemaErrorMap:this._def.errorMap,path:e.path,parent:e.parent}}_processInputParams(e){return{status:new Rn,ctx:{common:e.parent.common,data:e.data,parsedType:Fa(e.data),schemaErrorMap:this._def.errorMap,path:e.path,parent:e.parent}}}_parseSync(e){const n=this._parse(e);if(bd(n))throw new Error("Synchronous parse encountered promise.");return n}_parseAsync(e){const n=this._parse(e);return Promise.resolve(n)}parse(e,n){const r=this.safeParse(e,n);if(r.success)return r.data;throw r.error}safeParse(e,n){var r;const i={common:{issues:[],async:(r=n==null?void 0:n.async)!==null&&r!==void 0?r:!1,contextualErrorMap:n==null?void 0:n.errorMap},path:(n==null?void 0:n.path)||[],schemaErrorMap:this._def.errorMap,parent:null,data:e,parsedType:Fa(e)},s=this._parseSync({data:e,path:i.path,parent:i});return w8(i,s)}async parseAsync(e,n){const r=await this.safeParseAsync(e,n);if(r.success)return r.data;throw r.error}async safeParseAsync(e,n){const r={common:{issues:[],contextualErrorMap:n==null?void 0:n.errorMap,async:!0},path:(n==null?void 0:n.path)||[],schemaErrorMap:this._def.errorMap,parent:null,data:e,parsedType:Fa(e)},i=this._parse({data:e,path:r.path,parent:r}),s=await(bd(i)?i:Promise.resolve(i));return w8(r,s)}refine(e,n){const r=i=>typeof n=="string"||typeof n>"u"?{message:n}:typeof n=="function"?n(i):n;return this._refinement((i,s)=>{const a=e(i),o=()=>s.addIssue({code:se.custom,...r(i)});return typeof Promise<"u"&&a instanceof Promise?a.then(l=>l?!0:(o(),!1)):a?!0:(o(),!1)})}refinement(e,n){return this._refinement((r,i)=>e(r)?!0:(i.addIssue(typeof n=="function"?n(r,i):n),!1))}_refinement(e){return new Fi({schema:this,typeName:De.ZodEffects,effect:{type:"refinement",refinement:e}})}superRefine(e){return this._refinement(e)}optional(){return fs.create(this,this._def)}nullable(){return go.create(this,this._def)}nullish(){return this.nullable().optional()}array(){return Pi.create(this,this._def)}promise(){return qc.create(this,this._def)}or(e){return Cd.create([this,e],this._def)}and(e){return Td.create(this,e,this._def)}transform(e){return new Fi({...Re(this._def),schema:this,typeName:De.ZodEffects,effect:{type:"transform",transform:e}})}default(e){const n=typeof e=="function"?e:()=>e;return new Od({...Re(this._def),innerType:this,defaultValue:n,typeName:De.ZodDefault})}brand(){return new cv({typeName:De.ZodBranded,type:this,...Re(this._def)})}catch(e){const n=typeof e=="function"?e:()=>e;return new Md({...Re(this._def),innerType:this,catchValue:n,typeName:De.ZodCatch})}describe(e){const n=this.constructor;return new n({...this._def,description:e})}pipe(e){return hf.create(this,e)}readonly(){return Id.create(this)}isOptional(){return this.safeParse(void 0).success}isNullable(){return this.safeParse(null).success}}const Rj=/^c[^\s-]{8,}$/i,jj=/^[0-9a-z]+$/,Fj=/^[0-9A-HJKMNP-TV-Z]{26}$/,Bj=/^[0-9a-fA-F]{8}\b-[0-9a-fA-F]{4}\b-[0-9a-fA-F]{4}\b-[0-9a-fA-F]{4}\b-[0-9a-fA-F]{12}$/i,Hj=/^[a-z0-9_-]{21}$/i,zj=/^[-+]?P(?!$)(?:(?:[-+]?\d+Y)|(?:[-+]?\d+[.,]\d+Y$))?(?:(?:[-+]?\d+M)|(?:[-+]?\d+[.,]\d+M$))?(?:(?:[-+]?\d+W)|(?:[-+]?\d+[.,]\d+W$))?(?:(?:[-+]?\d+D)|(?:[-+]?\d+[.,]\d+D$))?(?:T(?=[\d+-])(?:(?:[-+]?\d+H)|(?:[-+]?\d+[.,]\d+H$))?(?:(?:[-+]?\d+M)|(?:[-+]?\d+[.,]\d+M$))?(?:[-+]?\d+(?:[.,]\d+)?S)?)??$/,Uj=/^(?!\.)(?!.*\.\.)([A-Z0-9_'+\-\.]*)[A-Z0-9_+-]@([A-Z0-9][A-Z0-9\-]*\.)+[A-Z]{2,}$/i,$j="^(\\p{Extended_Pictographic}|\\p{Emoji_Component})+$";let Wg;const Vj=/^(?:(?:25[0-5]|2[0-4][0-9]|1[0-9][0-9]|[1-9][0-9]|[0-9])\.){3}(?:25[0-5]|2[0-4][0-9]|1[0-9][0-9]|[1-9][0-9]|[0-9])$/,Yj=/^(([a-f0-9]{1,4}:){7}|::([a-f0-9]{1,4}:){0,6}|([a-f0-9]{1,4}:){1}:([a-f0-9]{1,4}:){0,5}|([a-f0-9]{1,4}:){2}:([a-f0-9]{1,4}:){0,4}|([a-f0-9]{1,4}:){3}:([a-f0-9]{1,4}:){0,3}|([a-f0-9]{1,4}:){4}:([a-f0-9]{1,4}:){0,2}|([a-f0-9]{1,4}:){5}:([a-f0-9]{1,4}:){0,1})([a-f0-9]{1,4}|(((25[0-5])|(2[0-4][0-9])|(1[0-9]{2})|([0-9]{1,2}))\.){3}((25[0-5])|(2[0-4][0-9])|(1[0-9]{2})|([0-9]{1,2})))$/,Wj=/^([0-9a-zA-Z+/]{4})*(([0-9a-zA-Z+/]{2}==)|([0-9a-zA-Z+/]{3}=))?$/,TT="((\\d\\d[2468][048]|\\d\\d[13579][26]|\\d\\d0[48]|[02468][048]00|[13579][26]00)-02-29|\\d{4}-((0[13578]|1[02])-(0[1-9]|[12]\\d|3[01])|(0[469]|11)-(0[1-9]|[12]\\d|30)|(02)-(0[1-9]|1\\d|2[0-8])))",Gj=new RegExp(`^${TT}$`);function ST(t){let e="([01]\\d|2[0-3]):[0-5]\\d:[0-5]\\d";return t.precision?e=`${e}\\.\\d{${t.precision}}`:t.precision==null&&(e=`${e}(\\.\\d+)?`),e}function Kj(t){return new RegExp(`^${ST(t)}$`)}function NT(t){let e=`${TT}T${ST(t)}`;const n=[];return n.push(t.local?"Z?":"Z"),t.offset&&n.push("([+-]\\d{2}:?\\d{2})"),e=`${e}(${n.join("|")})`,new RegExp(`^${e}$`)}function qj(t,e){return!!((e==="v4"||!e)&&Vj.test(t)||(e==="v6"||!e)&&Yj.test(t))}class Mi extends Fe{_parse(e){if(this._def.coerce&&(e.data=String(e.data)),this._getType(e)!==ve.string){const s=this._getOrReturnCtx(e);return pe(s,{code:se.invalid_type,expected:ve.string,received:s.parsedType}),Oe}const r=new Rn;let i;for(const s of this._def.checks)if(s.kind==="min")e.data.length<s.value&&(i=this._getOrReturnCtx(e,i),pe(i,{code:se.too_small,minimum:s.value,type:"string",inclusive:!0,exact:!1,message:s.message}),r.dirty());else if(s.kind==="max")e.data.length>s.value&&(i=this._getOrReturnCtx(e,i),pe(i,{code:se.too_big,maximum:s.value,type:"string",inclusive:!0,exact:!1,message:s.message}),r.dirty());else if(s.kind==="length"){const a=e.data.length>s.value,o=e.data.length<s.value;(a||o)&&(i=this._getOrReturnCtx(e,i),a?pe(i,{code:se.too_big,maximum:s.value,type:"string",inclusive:!0,exact:!0,message:s.message}):o&&pe(i,{code:se.too_small,minimum:s.value,type:"string",inclusive:!0,exact:!0,message:s.message}),r.dirty())}else if(s.kind==="email")Uj.test(e.data)||(i=this._getOrReturnCtx(e,i),pe(i,{validation:"email",code:se.invalid_string,message:s.message}),r.dirty());else if(s.kind==="emoji")Wg||(Wg=new RegExp($j,"u")),Wg.test(e.data)||(i=this._getOrReturnCtx(e,i),pe(i,{validation:"emoji",code:se.invalid_string,message:s.message}),r.dirty());else if(s.kind==="uuid")Bj.test(e.data)||(i=this._getOrReturnCtx(e,i),pe(i,{validation:"uuid",code:se.invalid_string,message:s.message}),r.dirty());else if(s.kind==="nanoid")Hj.test(e.data)||(i=this._getOrReturnCtx(e,i),pe(i,{validation:"nanoid",code:se.invalid_string,message:s.message}),r.dirty());else if(s.kind==="cuid")Rj.test(e.data)||(i=this._getOrReturnCtx(e,i),pe(i,{validation:"cuid",code:se.invalid_string,message:s.message}),r.dirty());else if(s.kind==="cuid2")jj.test(e.data)||(i=this._getOrReturnCtx(e,i),pe(i,{validation:"cuid2",code:se.invalid_string,message:s.message}),r.dirty());else if(s.kind==="ulid")Fj.test(e.data)||(i=this._getOrReturnCtx(e,i),pe(i,{validation:"ulid",code:se.invalid_string,message:s.message}),r.dirty());else if(s.kind==="url")try{new URL(e.data)}catch{i=this._getOrReturnCtx(e,i),pe(i,{validation:"url",code:se.invalid_string,message:s.message}),r.dirty()}else s.kind==="regex"?(s.regex.lastIndex=0,s.regex.test(e.data)||(i=this._getOrReturnCtx(e,i),pe(i,{validation:"regex",code:se.invalid_string,message:s.message}),r.dirty())):s.kind==="trim"?e.data=e.data.trim():s.kind==="includes"?e.data.includes(s.value,s.position)||(i=this._getOrReturnCtx(e,i),pe(i,{code:se.invalid_string,validation:{includes:s.value,position:s.position},message:s.message}),r.dirty()):s.kind==="toLowerCase"?e.data=e.data.toLowerCase():s.kind==="toUpperCase"?e.data=e.data.toUpperCase():s.kind==="startsWith"?e.data.startsWith(s.value)||(i=this._getOrReturnCtx(e,i),pe(i,{code:se.invalid_string,validation:{startsWith:s.value},message:s.message}),r.dirty()):s.kind==="endsWith"?e.data.endsWith(s.value)||(i=this._getOrReturnCtx(e,i),pe(i,{code:se.invalid_string,validation:{endsWith:s.value},message:s.message}),r.dirty()):s.kind==="datetime"?NT(s).test(e.data)||(i=this._getOrReturnCtx(e,i),pe(i,{code:se.invalid_string,validation:"datetime",message:s.message}),r.dirty()):s.kind==="date"?Gj.test(e.data)||(i=this._getOrReturnCtx(e,i),pe(i,{code:se.invalid_string,validation:"date",message:s.message}),r.dirty()):s.kind==="time"?Kj(s).test(e.data)||(i=this._getOrReturnCtx(e,i),pe(i,{code:se.invalid_string,validation:"time",message:s.message}),r.dirty()):s.kind==="duration"?zj.test(e.data)||(i=this._getOrReturnCtx(e,i),pe(i,{validation:"duration",code:se.invalid_string,message:s.message}),r.dirty()):s.kind==="ip"?qj(e.data,s.version)||(i=this._getOrReturnCtx(e,i),pe(i,{validation:"ip",code:se.invalid_string,message:s.message}),r.dirty()):s.kind==="base64"?Wj.test(e.data)||(i=this._getOrReturnCtx(e,i),pe(i,{validation:"base64",code:se.invalid_string,message:s.message}),r.dirty()):Je.assertNever(s);return{status:r.value,value:e.data}}_regex(e,n,r){return this.refinement(i=>e.test(i),{validation:n,code:se.invalid_string,...ke.errToObj(r)})}_addCheck(e){return new Mi({...this._def,checks:[...this._def.checks,e]})}email(e){return this._addCheck({kind:"email",...ke.errToObj(e)})}url(e){return this._addCheck({kind:"url",...ke.errToObj(e)})}emoji(e){return this._addCheck({kind:"emoji",...ke.errToObj(e)})}uuid(e){return this._addCheck({kind:"uuid",...ke.errToObj(e)})}nanoid(e){return this._addCheck({kind:"nanoid",...ke.errToObj(e)})}cuid(e){return this._addCheck({kind:"cuid",...ke.errToObj(e)})}cuid2(e){return this._addCheck({kind:"cuid2",...ke.errToObj(e)})}ulid(e){return this._addCheck({kind:"ulid",...ke.errToObj(e)})}base64(e){return this._addCheck({kind:"base64",...ke.errToObj(e)})}ip(e){return this._addCheck({kind:"ip",...ke.errToObj(e)})}datetime(e){var n,r;return typeof e=="string"?this._addCheck({kind:"datetime",precision:null,offset:!1,local:!1,message:e}):this._addCheck({kind:"datetime",precision:typeof(e==null?void 0:e.precision)>"u"?null:e==null?void 0:e.precision,offset:(n=e==null?void 0:e.offset)!==null&&n!==void 0?n:!1,local:(r=e==null?void 0:e.local)!==null&&r!==void 0?r:!1,...ke.errToObj(e==null?void 0:e.message)})}date(e){return this._addCheck({kind:"date",message:e})}time(e){return typeof e=="string"?this._addCheck({kind:"time",precision:null,message:e}):this._addCheck({kind:"time",precision:typeof(e==null?void 0:e.precision)>"u"?null:e==null?void 0:e.precision,...ke.errToObj(e==null?void 0:e.message)})}duration(e){return this._addCheck({kind:"duration",...ke.errToObj(e)})}regex(e,n){return this._addCheck({kind:"regex",regex:e,...ke.errToObj(n)})}includes(e,n){return this._addCheck({kind:"includes",value:e,position:n==null?void 0:n.position,...ke.errToObj(n==null?void 0:n.message)})}startsWith(e,n){return this._addCheck({kind:"startsWith",value:e,...ke.errToObj(n)})}endsWith(e,n){return this._addCheck({kind:"endsWith",value:e,...ke.errToObj(n)})}min(e,n){return this._addCheck({kind:"min",value:e,...ke.errToObj(n)})}max(e,n){return this._addCheck({kind:"max",value:e,...ke.errToObj(n)})}length(e,n){return this._addCheck({kind:"length",value:e,...ke.errToObj(n)})}nonempty(e){return this.min(1,ke.errToObj(e))}trim(){return new Mi({...this._def,checks:[...this._def.checks,{kind:"trim"}]})}toLowerCase(){return new Mi({...this._def,checks:[...this._def.checks,{kind:"toLowerCase"}]})}toUpperCase(){return new Mi({...this._def,checks:[...this._def.checks,{kind:"toUpperCase"}]})}get isDatetime(){return!!this._def.checks.find(e=>e.kind==="datetime")}get isDate(){return!!this._def.checks.find(e=>e.kind==="date")}get isTime(){return!!this._def.checks.find(e=>e.kind==="time")}get isDuration(){return!!this._def.checks.find(e=>e.kind==="duration")}get isEmail(){return!!this._def.checks.find(e=>e.kind==="email")}get isURL(){return!!this._def.checks.find(e=>e.kind==="url")}get isEmoji(){return!!this._def.checks.find(e=>e.kind==="emoji")}get isUUID(){return!!this._def.checks.find(e=>e.kind==="uuid")}get isNANOID(){return!!this._def.checks.find(e=>e.kind==="nanoid")}get isCUID(){return!!this._def.checks.find(e=>e.kind==="cuid")}get isCUID2(){return!!this._def.checks.find(e=>e.kind==="cuid2")}get isULID(){return!!this._def.checks.find(e=>e.kind==="ulid")}get isIP(){return!!this._def.checks.find(e=>e.kind==="ip")}get isBase64(){return!!this._def.checks.find(e=>e.kind==="base64")}get minLength(){let e=null;for(const n of this._def.checks)n.kind==="min"&&(e===null||n.value>e)&&(e=n.value);return e}get maxLength(){let e=null;for(const n of this._def.checks)n.kind==="max"&&(e===null||n.value<e)&&(e=n.value);return e}}Mi.create=t=>{var e;return new Mi({checks:[],typeName:De.ZodString,coerce:(e=t==null?void 0:t.coerce)!==null&&e!==void 0?e:!1,...Re(t)})};function Qj(t,e){const n=(t.toString().split(".")[1]||"").length,r=(e.toString().split(".")[1]||"").length,i=n>r?n:r,s=parseInt(t.toFixed(i).replace(".","")),a=parseInt(e.toFixed(i).replace(".",""));return s%a/Math.pow(10,i)}class ho extends Fe{constructor(){super(...arguments),this.min=this.gte,this.max=this.lte,this.step=this.multipleOf}_parse(e){if(this._def.coerce&&(e.data=Number(e.data)),this._getType(e)!==ve.number){const s=this._getOrReturnCtx(e);return pe(s,{code:se.invalid_type,expected:ve.number,received:s.parsedType}),Oe}let r;const i=new Rn;for(const s of this._def.checks)s.kind==="int"?Je.isInteger(e.data)||(r=this._getOrReturnCtx(e,r),pe(r,{code:se.invalid_type,expected:"integer",received:"float",message:s.message}),i.dirty()):s.kind==="min"?(s.inclusive?e.data<s.value:e.data<=s.value)&&(r=this._getOrReturnCtx(e,r),pe(r,{code:se.too_small,minimum:s.value,type:"number",inclusive:s.inclusive,exact:!1,message:s.message}),i.dirty()):s.kind==="max"?(s.inclusive?e.data>s.value:e.data>=s.value)&&(r=this._getOrReturnCtx(e,r),pe(r,{code:se.too_big,maximum:s.value,type:"number",inclusive:s.inclusive,exact:!1,message:s.message}),i.dirty()):s.kind==="multipleOf"?Qj(e.data,s.value)!==0&&(r=this._getOrReturnCtx(e,r),pe(r,{code:se.not_multiple_of,multipleOf:s.value,message:s.message}),i.dirty()):s.kind==="finite"?Number.isFinite(e.data)||(r=this._getOrReturnCtx(e,r),pe(r,{code:se.not_finite,message:s.message}),i.dirty()):Je.assertNever(s);return{status:i.value,value:e.data}}gte(e,n){return this.setLimit("min",e,!0,ke.toString(n))}gt(e,n){return this.setLimit("min",e,!1,ke.toString(n))}lte(e,n){return this.setLimit("max",e,!0,ke.toString(n))}lt(e,n){return this.setLimit("max",e,!1,ke.toString(n))}setLimit(e,n,r,i){return new ho({...this._def,checks:[...this._def.checks,{kind:e,value:n,inclusive:r,message:ke.toString(i)}]})}_addCheck(e){return new ho({...this._def,checks:[...this._def.checks,e]})}int(e){return this._addCheck({kind:"int",message:ke.toString(e)})}positive(e){return this._addCheck({kind:"min",value:0,inclusive:!1,message:ke.toString(e)})}negative(e){return this._addCheck({kind:"max",value:0,inclusive:!1,message:ke.toString(e)})}nonpositive(e){return this._addCheck({kind:"max",value:0,inclusive:!0,message:ke.toString(e)})}nonnegative(e){return this._addCheck({kind:"min",value:0,inclusive:!0,message:ke.toString(e)})}multipleOf(e,n){return this._addCheck({kind:"multipleOf",value:e,message:ke.toString(n)})}finite(e){return this._addCheck({kind:"finite",message:ke.toString(e)})}safe(e){return this._addCheck({kind:"min",inclusive:!0,value:Number.MIN_SAFE_INTEGER,message:ke.toString(e)})._addCheck({kind:"max",inclusive:!0,value:Number.MAX_SAFE_INTEGER,message:ke.toString(e)})}get minValue(){let e=null;for(const n of this._def.checks)n.kind==="min"&&(e===null||n.value>e)&&(e=n.value);return e}get maxValue(){let e=null;for(const n of this._def.checks)n.kind==="max"&&(e===null||n.value<e)&&(e=n.value);return e}get isInt(){return!!this._def.checks.find(e=>e.kind==="int"||e.kind==="multipleOf"&&Je.isInteger(e.value))}get isFinite(){let e=null,n=null;for(const r of this._def.checks){if(r.kind==="finite"||r.kind==="int"||r.kind==="multipleOf")return!0;r.kind==="min"?(n===null||r.value>n)&&(n=r.value):r.kind==="max"&&(e===null||r.value<e)&&(e=r.value)}return Number.isFinite(n)&&Number.isFinite(e)}}ho.create=t=>new ho({checks:[],typeName:De.ZodNumber,coerce:(t==null?void 0:t.coerce)||!1,...Re(t)});class po extends Fe{constructor(){super(...arguments),this.min=this.gte,this.max=this.lte}_parse(e){if(this._def.coerce&&(e.data=BigInt(e.data)),this._getType(e)!==ve.bigint){const s=this._getOrReturnCtx(e);return pe(s,{code:se.invalid_type,expected:ve.bigint,received:s.parsedType}),Oe}let r;const i=new Rn;for(const s of this._def.checks)s.kind==="min"?(s.inclusive?e.data<s.value:e.data<=s.value)&&(r=this._getOrReturnCtx(e,r),pe(r,{code:se.too_small,type:"bigint",minimum:s.value,inclusive:s.inclusive,message:s.message}),i.dirty()):s.kind==="max"?(s.inclusive?e.data>s.value:e.data>=s.value)&&(r=this._getOrReturnCtx(e,r),pe(r,{code:se.too_big,type:"bigint",maximum:s.value,inclusive:s.inclusive,message:s.message}),i.dirty()):s.kind==="multipleOf"?e.data%s.value!==BigInt(0)&&(r=this._getOrReturnCtx(e,r),pe(r,{code:se.not_multiple_of,multipleOf:s.value,message:s.message}),i.dirty()):Je.assertNever(s);return{status:i.value,value:e.data}}gte(e,n){return this.setLimit("min",e,!0,ke.toString(n))}gt(e,n){return this.setLimit("min",e,!1,ke.toString(n))}lte(e,n){return this.setLimit("max",e,!0,ke.toString(n))}lt(e,n){return this.setLimit("max",e,!1,ke.toString(n))}setLimit(e,n,r,i){return new po({...this._def,checks:[...this._def.checks,{kind:e,value:n,inclusive:r,message:ke.toString(i)}]})}_addCheck(e){return new po({...this._def,checks:[...this._def.checks,e]})}positive(e){return this._addCheck({kind:"min",value:BigInt(0),inclusive:!1,message:ke.toString(e)})}negative(e){return this._addCheck({kind:"max",value:BigInt(0),inclusive:!1,message:ke.toString(e)})}nonpositive(e){return this._addCheck({kind:"max",value:BigInt(0),inclusive:!0,message:ke.toString(e)})}nonnegative(e){return this._addCheck({kind:"min",value:BigInt(0),inclusive:!0,message:ke.toString(e)})}multipleOf(e,n){return this._addCheck({kind:"multipleOf",value:e,message:ke.toString(n)})}get minValue(){let e=null;for(const n of this._def.checks)n.kind==="min"&&(e===null||n.value>e)&&(e=n.value);return e}get maxValue(){let e=null;for(const n of this._def.checks)n.kind==="max"&&(e===null||n.value<e)&&(e=n.value);return e}}po.create=t=>{var e;return new po({checks:[],typeName:De.ZodBigInt,coerce:(e=t==null?void 0:t.coerce)!==null&&e!==void 0?e:!1,...Re(t)})};class wd extends Fe{_parse(e){if(this._def.coerce&&(e.data=!!e.data),this._getType(e)!==ve.boolean){const r=this._getOrReturnCtx(e);return pe(r,{code:se.invalid_type,expected:ve.boolean,received:r.parsedType}),Oe}return Gn(e.data)}}wd.create=t=>new wd({typeName:De.ZodBoolean,coerce:(t==null?void 0:t.coerce)||!1,...Re(t)});class bl extends Fe{_parse(e){if(this._def.coerce&&(e.data=new Date(e.data)),this._getType(e)!==ve.date){const s=this._getOrReturnCtx(e);return pe(s,{code:se.invalid_type,expected:ve.date,received:s.parsedType}),Oe}if(isNaN(e.data.getTime())){const s=this._getOrReturnCtx(e);return pe(s,{code:se.invalid_date}),Oe}const r=new Rn;let i;for(const s of this._def.checks)s.kind==="min"?e.data.getTime()<s.value&&(i=this._getOrReturnCtx(e,i),pe(i,{code:se.too_small,message:s.message,inclusive:!0,exact:!1,minimum:s.value,type:"date"}),r.dirty()):s.kind==="max"?e.data.getTime()>s.value&&(i=this._getOrReturnCtx(e,i),pe(i,{code:se.too_big,message:s.message,inclusive:!0,exact:!1,maximum:s.value,type:"date"}),r.dirty()):Je.assertNever(s);return{status:r.value,value:new Date(e.data.getTime())}}_addCheck(e){return new bl({...this._def,checks:[...this._def.checks,e]})}min(e,n){return this._addCheck({kind:"min",value:e.getTime(),message:ke.toString(n)})}max(e,n){return this._addCheck({kind:"max",value:e.getTime(),message:ke.toString(n)})}get minDate(){let e=null;for(const n of this._def.checks)n.kind==="min"&&(e===null||n.value>e)&&(e=n.value);return e!=null?new Date(e):null}get maxDate(){let e=null;for(const n of this._def.checks)n.kind==="max"&&(e===null||n.value<e)&&(e=n.value);return e!=null?new Date(e):null}}bl.create=t=>new bl({checks:[],coerce:(t==null?void 0:t.coerce)||!1,typeName:De.ZodDate,...Re(t)});class xm extends Fe{_parse(e){if(this._getType(e)!==ve.symbol){const r=this._getOrReturnCtx(e);return pe(r,{code:se.invalid_type,expected:ve.symbol,received:r.parsedType}),Oe}return Gn(e.data)}}xm.create=t=>new xm({typeName:De.ZodSymbol,...Re(t)});class Ed extends Fe{_parse(e){if(this._getType(e)!==ve.undefined){const r=this._getOrReturnCtx(e);return pe(r,{code:se.invalid_type,expected:ve.undefined,received:r.parsedType}),Oe}return Gn(e.data)}}Ed.create=t=>new Ed({typeName:De.ZodUndefined,...Re(t)});class kd extends Fe{_parse(e){if(this._getType(e)!==ve.null){const r=this._getOrReturnCtx(e);return pe(r,{code:se.invalid_type,expected:ve.null,received:r.parsedType}),Oe}return Gn(e.data)}}kd.create=t=>new kd({typeName:De.ZodNull,...Re(t)});class Kc extends Fe{constructor(){super(...arguments),this._any=!0}_parse(e){return Gn(e.data)}}Kc.create=t=>new Kc({typeName:De.ZodAny,...Re(t)});class cl extends Fe{constructor(){super(...arguments),this._unknown=!0}_parse(e){return Gn(e.data)}}cl.create=t=>new cl({typeName:De.ZodUnknown,...Re(t)});class oa extends Fe{_parse(e){const n=this._getOrReturnCtx(e);return pe(n,{code:se.invalid_type,expected:ve.never,received:n.parsedType}),Oe}}oa.create=t=>new oa({typeName:De.ZodNever,...Re(t)});class _m extends Fe{_parse(e){if(this._getType(e)!==ve.undefined){const r=this._getOrReturnCtx(e);return pe(r,{code:se.invalid_type,expected:ve.void,received:r.parsedType}),Oe}return Gn(e.data)}}_m.create=t=>new _m({typeName:De.ZodVoid,...Re(t)});class Pi extends Fe{_parse(e){const{ctx:n,status:r}=this._processInputParams(e),i=this._def;if(n.parsedType!==ve.array)return pe(n,{code:se.invalid_type,expected:ve.array,received:n.parsedType}),Oe;if(i.exactLength!==null){const a=n.data.length>i.exactLength.value,o=n.data.length<i.exactLength.value;(a||o)&&(pe(n,{code:a?se.too_big:se.too_small,minimum:o?i.exactLength.value:void 0,maximum:a?i.exactLength.value:void 0,type:"array",inclusive:!0,exact:!0,message:i.exactLength.message}),r.dirty())}if(i.minLength!==null&&n.data.length<i.minLength.value&&(pe(n,{code:se.too_small,minimum:i.minLength.value,type:"array",inclusive:!0,exact:!1,message:i.minLength.message}),r.dirty()),i.maxLength!==null&&n.data.length>i.maxLength.value&&(pe(n,{code:se.too_big,maximum:i.maxLength.value,type:"array",inclusive:!0,exact:!1,message:i.maxLength.message}),r.dirty()),n.common.async)return Promise.all([...n.data].map((a,o)=>i.type._parseAsync(new bs(n,a,n.path,o)))).then(a=>Rn.mergeArray(r,a));const s=[...n.data].map((a,o)=>i.type._parseSync(new bs(n,a,n.path,o)));return Rn.mergeArray(r,s)}get element(){return this._def.type}min(e,n){return new Pi({...this._def,minLength:{value:e,message:ke.toString(n)}})}max(e,n){return new Pi({...this._def,maxLength:{value:e,message:ke.toString(n)}})}length(e,n){return new Pi({...this._def,exactLength:{value:e,message:ke.toString(n)}})}nonempty(e){return this.min(1,e)}}Pi.create=(t,e)=>new Pi({type:t,minLength:null,maxLength:null,exactLength:null,typeName:De.ZodArray,...Re(e)});function Jl(t){if(t instanceof Mt){const e={};for(const n in t.shape){const r=t.shape[n];e[n]=fs.create(Jl(r))}return new Mt({...t._def,shape:()=>e})}else return t instanceof Pi?new Pi({...t._def,type:Jl(t.element)}):t instanceof fs?fs.create(Jl(t.unwrap())):t instanceof go?go.create(Jl(t.unwrap())):t instanceof ws?ws.create(t.items.map(e=>Jl(e))):t}class Mt extends Fe{constructor(){super(...arguments),this._cached=null,this.nonstrict=this.passthrough,this.augment=this.extend}_getCached(){if(this._cached!==null)return this._cached;const e=this._def.shape(),n=Je.objectKeys(e);return this._cached={shape:e,keys:n}}_parse(e){if(this._getType(e)!==ve.object){const c=this._getOrReturnCtx(e);return pe(c,{code:se.invalid_type,expected:ve.object,received:c.parsedType}),Oe}const{status:r,ctx:i}=this._processInputParams(e),{shape:s,keys:a}=this._getCached(),o=[];if(!(this._def.catchall instanceof oa&&this._def.unknownKeys==="strip"))for(const c in i.data)a.includes(c)||o.push(c);const l=[];for(const c of a){const u=s[c],d=i.data[c];l.push({key:{status:"valid",value:c},value:u._parse(new bs(i,d,i.path,c)),alwaysSet:c in i.data})}if(this._def.catchall instanceof oa){const c=this._def.unknownKeys;if(c==="passthrough")for(const u of o)l.push({key:{status:"valid",value:u},value:{status:"valid",value:i.data[u]}});else if(c==="strict")o.length>0&&(pe(i,{code:se.unrecognized_keys,keys:o}),r.dirty());else if(c!=="strip")throw new Error("Internal ZodObject error: invalid unknownKeys value.")}else{const c=this._def.catchall;for(const u of o){const d=i.data[u];l.push({key:{status:"valid",value:u},value:c._parse(new bs(i,d,i.path,u)),alwaysSet:u in i.data})}}return i.common.async?Promise.resolve().then(async()=>{const c=[];for(const u of l){const d=await u.key,h=await u.value;c.push({key:d,value:h,alwaysSet:u.alwaysSet})}return c}).then(c=>Rn.mergeObjectSync(r,c)):Rn.mergeObjectSync(r,l)}get shape(){return this._def.shape()}strict(e){return ke.errToObj,new Mt({...this._def,unknownKeys:"strict",...e!==void 0?{errorMap:(n,r)=>{var i,s,a,o;const l=(a=(s=(i=this._def).errorMap)===null||s===void 0?void 0:s.call(i,n,r).message)!==null&&a!==void 0?a:r.defaultError;return n.code==="unrecognized_keys"?{message:(o=ke.errToObj(e).message)!==null&&o!==void 0?o:l}:{message:l}}}:{}})}strip(){return new Mt({...this._def,unknownKeys:"strip"})}passthrough(){return new Mt({...this._def,unknownKeys:"passthrough"})}extend(e){return new Mt({...this._def,shape:()=>({...this._def.shape(),...e})})}merge(e){return new Mt({unknownKeys:e._def.unknownKeys,catchall:e._def.catchall,shape:()=>({...this._def.shape(),...e._def.shape()}),typeName:De.ZodObject})}setKey(e,n){return this.augment({[e]:n})}catchall(e){return new Mt({...this._def,catchall:e})}pick(e){const n={};return Je.objectKeys(e).forEach(r=>{e[r]&&this.shape[r]&&(n[r]=this.shape[r])}),new Mt({...this._def,shape:()=>n})}omit(e){const n={};return Je.objectKeys(this.shape).forEach(r=>{e[r]||(n[r]=this.shape[r])}),new Mt({...this._def,shape:()=>n})}deepPartial(){return Jl(this)}partial(e){const n={};return Je.objectKeys(this.shape).forEach(r=>{const i=this.shape[r];e&&!e[r]?n[r]=i:n[r]=i.optional()}),new Mt({...this._def,shape:()=>n})}required(e){const n={};return Je.objectKeys(this.shape).forEach(r=>{if(e&&!e[r])n[r]=this.shape[r];else{let s=this.shape[r];for(;s instanceof fs;)s=s._def.innerType;n[r]=s}}),new Mt({...this._def,shape:()=>n})}keyof(){return AT(Je.objectKeys(this.shape))}}Mt.create=(t,e)=>new Mt({shape:()=>t,unknownKeys:"strip",catchall:oa.create(),typeName:De.ZodObject,...Re(e)});Mt.strictCreate=(t,e)=>new Mt({shape:()=>t,unknownKeys:"strict",catchall:oa.create(),typeName:De.ZodObject,...Re(e)});Mt.lazycreate=(t,e)=>new Mt({shape:t,unknownKeys:"strip",catchall:oa.create(),typeName:De.ZodObject,...Re(e)});class Cd extends Fe{_parse(e){const{ctx:n}=this._processInputParams(e),r=this._def.options;function i(s){for(const o of s)if(o.result.status==="valid")return o.result;for(const o of s)if(o.result.status==="dirty")return n.common.issues.push(...o.ctx.common.issues),o.result;const a=s.map(o=>new Nr(o.ctx.common.issues));return pe(n,{code:se.invalid_union,unionErrors:a}),Oe}if(n.common.async)return Promise.all(r.map(async s=>{const a={...n,common:{...n.common,issues:[]},parent:null};return{result:await s._parseAsync({data:n.data,path:n.path,parent:a}),ctx:a}})).then(i);{let s;const a=[];for(const l of r){const c={...n,common:{...n.common,issues:[]},parent:null},u=l._parseSync({data:n.data,path:n.path,parent:c});if(u.status==="valid")return u;u.status==="dirty"&&!s&&(s={result:u,ctx:c}),c.common.issues.length&&a.push(c.common.issues)}if(s)return n.common.issues.push(...s.ctx.common.issues),s.result;const o=a.map(l=>new Nr(l));return pe(n,{code:se.invalid_union,unionErrors:o}),Oe}}get options(){return this._def.options}}Cd.create=(t,e)=>new Cd({options:t,typeName:De.ZodUnion,...Re(e)});const Us=t=>t instanceof Nd?Us(t.schema):t instanceof Fi?Us(t.innerType()):t instanceof Ad?[t.value]:t instanceof mo?t.options:t instanceof Dd?Je.objectValues(t.enum):t instanceof Od?Us(t._def.innerType):t instanceof Ed?[void 0]:t instanceof kd?[null]:t instanceof fs?[void 0,...Us(t.unwrap())]:t instanceof go?[null,...Us(t.unwrap())]:t instanceof cv||t instanceof Id?Us(t.unwrap()):t instanceof Md?Us(t._def.innerType):[];class A0 extends Fe{_parse(e){const{ctx:n}=this._processInputParams(e);if(n.parsedType!==ve.object)return pe(n,{code:se.invalid_type,expected:ve.object,received:n.parsedType}),Oe;const r=this.discriminator,i=n.data[r],s=this.optionsMap.get(i);return s?n.common.async?s._parseAsync({data:n.data,path:n.path,parent:n}):s._parseSync({data:n.data,path:n.path,parent:n}):(pe(n,{code:se.invalid_union_discriminator,options:Array.from(this.optionsMap.keys()),path:[r]}),Oe)}get discriminator(){return this._def.discriminator}get options(){return this._def.options}get optionsMap(){return this._def.optionsMap}static create(e,n,r){const i=new Map;for(const s of n){const a=Us(s.shape[e]);if(!a.length)throw new Error(`A discriminator value for key \`${e}\` could not be extracted from all schema options`);for(const o of a){if(i.has(o))throw new Error(`Discriminator property ${String(e)} has duplicate value ${String(o)}`);i.set(o,s)}}return new A0({typeName:De.ZodDiscriminatedUnion,discriminator:e,options:n,optionsMap:i,...Re(r)})}}function I4(t,e){const n=Fa(t),r=Fa(e);if(t===e)return{valid:!0,data:t};if(n===ve.object&&r===ve.object){const i=Je.objectKeys(e),s=Je.objectKeys(t).filter(o=>i.indexOf(o)!==-1),a={...t,...e};for(const o of s){const l=I4(t[o],e[o]);if(!l.valid)return{valid:!1};a[o]=l.data}return{valid:!0,data:a}}else if(n===ve.array&&r===ve.array){if(t.length!==e.length)return{valid:!1};const i=[];for(let s=0;s<t.length;s++){const a=t[s],o=e[s],l=I4(a,o);if(!l.valid)return{valid:!1};i.push(l.data)}return{valid:!0,data:i}}else return n===ve.date&&r===ve.date&&+t==+e?{valid:!0,data:t}:{valid:!1}}class Td extends Fe{_parse(e){const{status:n,ctx:r}=this._processInputParams(e),i=(s,a)=>{if(O4(s)||O4(a))return Oe;const o=I4(s.value,a.value);return o.valid?((M4(s)||M4(a))&&n.dirty(),{status:n.value,value:o.data}):(pe(r,{code:se.invalid_intersection_types}),Oe)};return r.common.async?Promise.all([this._def.left._parseAsync({data:r.data,path:r.path,parent:r}),this._def.right._parseAsync({data:r.data,path:r.path,parent:r})]).then(([s,a])=>i(s,a)):i(this._def.left._parseSync({data:r.data,path:r.path,parent:r}),this._def.right._parseSync({data:r.data,path:r.path,parent:r}))}}Td.create=(t,e,n)=>new Td({left:t,right:e,typeName:De.ZodIntersection,...Re(n)});class ws extends Fe{_parse(e){const{status:n,ctx:r}=this._processInputParams(e);if(r.parsedType!==ve.array)return pe(r,{code:se.invalid_type,expected:ve.array,received:r.parsedType}),Oe;if(r.data.length<this._def.items.length)return pe(r,{code:se.too_small,minimum:this._def.items.length,inclusive:!0,exact:!1,type:"array"}),Oe;!this._def.rest&&r.data.length>this._def.items.length&&(pe(r,{code:se.too_big,maximum:this._def.items.length,inclusive:!0,exact:!1,type:"array"}),n.dirty());const s=[...r.data].map((a,o)=>{const l=this._def.items[o]||this._def.rest;return l?l._parse(new bs(r,a,r.path,o)):null}).filter(a=>!!a);return r.common.async?Promise.all(s).then(a=>Rn.mergeArray(n,a)):Rn.mergeArray(n,s)}get items(){return this._def.items}rest(e){return new ws({...this._def,rest:e})}}ws.create=(t,e)=>{if(!Array.isArray(t))throw new Error("You must pass an array of schemas to z.tuple([ ... ])");return new ws({items:t,typeName:De.ZodTuple,rest:null,...Re(e)})};class Sd extends Fe{get keySchema(){return this._def.keyType}get valueSchema(){return this._def.valueType}_parse(e){const{status:n,ctx:r}=this._processInputParams(e);if(r.parsedType!==ve.object)return pe(r,{code:se.invalid_type,expected:ve.object,received:r.parsedType}),Oe;const i=[],s=this._def.keyType,a=this._def.valueType;for(const o in r.data)i.push({key:s._parse(new bs(r,o,r.path,o)),value:a._parse(new bs(r,r.data[o],r.path,o)),alwaysSet:o in r.data});return r.common.async?Rn.mergeObjectAsync(n,i):Rn.mergeObjectSync(n,i)}get element(){return this._def.valueType}static create(e,n,r){return n instanceof Fe?new Sd({keyType:e,valueType:n,typeName:De.ZodRecord,...Re(r)}):new Sd({keyType:Mi.create(),valueType:e,typeName:De.ZodRecord,...Re(n)})}}class bm extends Fe{get keySchema(){return this._def.keyType}get valueSchema(){return this._def.valueType}_parse(e){const{status:n,ctx:r}=this._processInputParams(e);if(r.parsedType!==ve.map)return pe(r,{code:se.invalid_type,expected:ve.map,received:r.parsedType}),Oe;const i=this._def.keyType,s=this._def.valueType,a=[...r.data.entries()].map(([o,l],c)=>({key:i._parse(new bs(r,o,r.path,[c,"key"])),value:s._parse(new bs(r,l,r.path,[c,"value"]))}));if(r.common.async){const o=new Map;return Promise.resolve().then(async()=>{for(const l of a){const c=await l.key,u=await l.value;if(c.status==="aborted"||u.status==="aborted")return Oe;(c.status==="dirty"||u.status==="dirty")&&n.dirty(),o.set(c.value,u.value)}return{status:n.value,value:o}})}else{const o=new Map;for(const l of a){const c=l.key,u=l.value;if(c.status==="aborted"||u.status==="aborted")return Oe;(c.status==="dirty"||u.status==="dirty")&&n.dirty(),o.set(c.value,u.value)}return{status:n.value,value:o}}}}bm.create=(t,e,n)=>new bm({valueType:e,keyType:t,typeName:De.ZodMap,...Re(n)});class wl extends Fe{_parse(e){const{status:n,ctx:r}=this._processInputParams(e);if(r.parsedType!==ve.set)return pe(r,{code:se.invalid_type,expected:ve.set,received:r.parsedType}),Oe;const i=this._def;i.minSize!==null&&r.data.size<i.minSize.value&&(pe(r,{code:se.too_small,minimum:i.minSize.value,type:"set",inclusive:!0,exact:!1,message:i.minSize.message}),n.dirty()),i.maxSize!==null&&r.data.size>i.maxSize.value&&(pe(r,{code:se.too_big,maximum:i.maxSize.value,type:"set",inclusive:!0,exact:!1,message:i.maxSize.message}),n.dirty());const s=this._def.valueType;function a(l){const c=new Set;for(const u of l){if(u.status==="aborted")return Oe;u.status==="dirty"&&n.dirty(),c.add(u.value)}return{status:n.value,value:c}}const o=[...r.data.values()].map((l,c)=>s._parse(new bs(r,l,r.path,c)));return r.common.async?Promise.all(o).then(l=>a(l)):a(o)}min(e,n){return new wl({...this._def,minSize:{value:e,message:ke.toString(n)}})}max(e,n){return new wl({...this._def,maxSize:{value:e,message:ke.toString(n)}})}size(e,n){return this.min(e,n).max(e,n)}nonempty(e){return this.min(1,e)}}wl.create=(t,e)=>new wl({valueType:t,minSize:null,maxSize:null,typeName:De.ZodSet,...Re(e)});class Oc extends Fe{constructor(){super(...arguments),this.validate=this.implement}_parse(e){const{ctx:n}=this._processInputParams(e);if(n.parsedType!==ve.function)return pe(n,{code:se.invalid_type,expected:ve.function,received:n.parsedType}),Oe;function r(o,l){return ym({data:o,path:n.path,errorMaps:[n.common.contextualErrorMap,n.schemaErrorMap,gm(),Gc].filter(c=>!!c),issueData:{code:se.invalid_arguments,argumentsError:l}})}function i(o,l){return ym({data:o,path:n.path,errorMaps:[n.common.contextualErrorMap,n.schemaErrorMap,gm(),Gc].filter(c=>!!c),issueData:{code:se.invalid_return_type,returnTypeError:l}})}const s={errorMap:n.common.contextualErrorMap},a=n.data;if(this._def.returns instanceof qc){const o=this;return Gn(async function(...l){const c=new Nr([]),u=await o._def.args.parseAsync(l,s).catch(p=>{throw c.addIssue(r(l,p)),c}),d=await Reflect.apply(a,this,u);return await o._def.returns._def.type.parseAsync(d,s).catch(p=>{throw c.addIssue(i(d,p)),c})})}else{const o=this;return Gn(function(...l){const c=o._def.args.safeParse(l,s);if(!c.success)throw new Nr([r(l,c.error)]);const u=Reflect.apply(a,this,c.data),d=o._def.returns.safeParse(u,s);if(!d.success)throw new Nr([i(u,d.error)]);return d.data})}}parameters(){return this._def.args}returnType(){return this._def.returns}args(...e){return new Oc({...this._def,args:ws.create(e).rest(cl.create())})}returns(e){return new Oc({...this._def,returns:e})}implement(e){return this.parse(e)}strictImplement(e){return this.parse(e)}static create(e,n,r){return new Oc({args:e||ws.create([]).rest(cl.create()),returns:n||cl.create(),typeName:De.ZodFunction,...Re(r)})}}class Nd extends Fe{get schema(){return this._def.getter()}_parse(e){const{ctx:n}=this._processInputParams(e);return this._def.getter()._parse({data:n.data,path:n.path,parent:n})}}Nd.create=(t,e)=>new Nd({getter:t,typeName:De.ZodLazy,...Re(e)});class Ad extends Fe{_parse(e){if(e.data!==this._def.value){const n=this._getOrReturnCtx(e);return pe(n,{received:n.data,code:se.invalid_literal,expected:this._def.value}),Oe}return{status:"valid",value:e.data}}get value(){return this._def.value}}Ad.create=(t,e)=>new Ad({value:t,typeName:De.ZodLiteral,...Re(e)});function AT(t,e){return new mo({values:t,typeName:De.ZodEnum,...Re(e)})}class mo extends Fe{constructor(){super(...arguments),m1.set(this,void 0)}_parse(e){if(typeof e.data!="string"){const n=this._getOrReturnCtx(e),r=this._def.values;return pe(n,{expected:Je.joinValues(r),received:n.parsedType,code:se.invalid_type}),Oe}if(vm(this,m1)||CT(this,m1,new Set(this._def.values)),!vm(this,m1).has(e.data)){const n=this._getOrReturnCtx(e),r=this._def.values;return pe(n,{received:n.data,code:se.invalid_enum_value,options:r}),Oe}return Gn(e.data)}get options(){return this._def.values}get enum(){const e={};for(const n of this._def.values)e[n]=n;return e}get Values(){const e={};for(const n of this._def.values)e[n]=n;return e}get Enum(){const e={};for(const n of this._def.values)e[n]=n;return e}extract(e,n=this._def){return mo.create(e,{...this._def,...n})}exclude(e,n=this._def){return mo.create(this.options.filter(r=>!e.includes(r)),{...this._def,...n})}}m1=new WeakMap;mo.create=AT;class Dd extends Fe{constructor(){super(...arguments),g1.set(this,void 0)}_parse(e){const n=Je.getValidEnumValues(this._def.values),r=this._getOrReturnCtx(e);if(r.parsedType!==ve.string&&r.parsedType!==ve.number){const i=Je.objectValues(n);return pe(r,{expected:Je.joinValues(i),received:r.parsedType,code:se.invalid_type}),Oe}if(vm(this,g1)||CT(this,g1,new Set(Je.getValidEnumValues(this._def.values))),!vm(this,g1).has(e.data)){const i=Je.objectValues(n);return pe(r,{received:r.data,code:se.invalid_enum_value,options:i}),Oe}return Gn(e.data)}get enum(){return this._def.values}}g1=new WeakMap;Dd.create=(t,e)=>new Dd({values:t,typeName:De.ZodNativeEnum,...Re(e)});class qc extends Fe{unwrap(){return this._def.type}_parse(e){const{ctx:n}=this._processInputParams(e);if(n.parsedType!==ve.promise&&n.common.async===!1)return pe(n,{code:se.invalid_type,expected:ve.promise,received:n.parsedType}),Oe;const r=n.parsedType===ve.promise?n.data:Promise.resolve(n.data);return Gn(r.then(i=>this._def.type.parseAsync(i,{path:n.path,errorMap:n.common.contextualErrorMap})))}}qc.create=(t,e)=>new qc({type:t,typeName:De.ZodPromise,...Re(e)});class Fi extends Fe{innerType(){return this._def.schema}sourceType(){return this._def.schema._def.typeName===De.ZodEffects?this._def.schema.sourceType():this._def.schema}_parse(e){const{status:n,ctx:r}=this._processInputParams(e),i=this._def.effect||null,s={addIssue:a=>{pe(r,a),a.fatal?n.abort():n.dirty()},get path(){return r.path}};if(s.addIssue=s.addIssue.bind(s),i.type==="preprocess"){const a=i.transform(r.data,s);if(r.common.async)return Promise.resolve(a).then(async o=>{if(n.value==="aborted")return Oe;const l=await this._def.schema._parseAsync({data:o,path:r.path,parent:r});return l.status==="aborted"?Oe:l.status==="dirty"||n.value==="dirty"?gc(l.value):l});{if(n.value==="aborted")return Oe;const o=this._def.schema._parseSync({data:a,path:r.path,parent:r});return o.status==="aborted"?Oe:o.status==="dirty"||n.value==="dirty"?gc(o.value):o}}if(i.type==="refinement"){const a=o=>{const l=i.refinement(o,s);if(r.common.async)return Promise.resolve(l);if(l instanceof Promise)throw new Error("Async refinement encountered during synchronous parse operation. Use .parseAsync instead.");return o};if(r.common.async===!1){const o=this._def.schema._parseSync({data:r.data,path:r.path,parent:r});return o.status==="aborted"?Oe:(o.status==="dirty"&&n.dirty(),a(o.value),{status:n.value,value:o.value})}else return this._def.schema._parseAsync({data:r.data,path:r.path,parent:r}).then(o=>o.status==="aborted"?Oe:(o.status==="dirty"&&n.dirty(),a(o.value).then(()=>({status:n.value,value:o.value}))))}if(i.type==="transform")if(r.common.async===!1){const a=this._def.schema._parseSync({data:r.data,path:r.path,parent:r});if(!_d(a))return a;const o=i.transform(a.value,s);if(o instanceof Promise)throw new Error("Asynchronous transform encountered during synchronous parse operation. Use .parseAsync instead.");return{status:n.value,value:o}}else return this._def.schema._parseAsync({data:r.data,path:r.path,parent:r}).then(a=>_d(a)?Promise.resolve(i.transform(a.value,s)).then(o=>({status:n.value,value:o})):a);Je.assertNever(i)}}Fi.create=(t,e,n)=>new Fi({schema:t,typeName:De.ZodEffects,effect:e,...Re(n)});Fi.createWithPreprocess=(t,e,n)=>new Fi({schema:e,effect:{type:"preprocess",transform:t},typeName:De.ZodEffects,...Re(n)});class fs extends Fe{_parse(e){return this._getType(e)===ve.undefined?Gn(void 0):this._def.innerType._parse(e)}unwrap(){return this._def.innerType}}fs.create=(t,e)=>new fs({innerType:t,typeName:De.ZodOptional,...Re(e)});class go extends Fe{_parse(e){return this._getType(e)===ve.null?Gn(null):this._def.innerType._parse(e)}unwrap(){return this._def.innerType}}go.create=(t,e)=>new go({innerType:t,typeName:De.ZodNullable,...Re(e)});class Od extends Fe{_parse(e){const{ctx:n}=this._processInputParams(e);let r=n.data;return n.parsedType===ve.undefined&&(r=this._def.defaultValue()),this._def.innerType._parse({data:r,path:n.path,parent:n})}removeDefault(){return this._def.innerType}}Od.create=(t,e)=>new Od({innerType:t,typeName:De.ZodDefault,defaultValue:typeof e.default=="function"?e.default:()=>e.default,...Re(e)});class Md extends Fe{_parse(e){const{ctx:n}=this._processInputParams(e),r={...n,common:{...n.common,issues:[]}},i=this._def.innerType._parse({data:r.data,path:r.path,parent:{...r}});return bd(i)?i.then(s=>({status:"valid",value:s.status==="valid"?s.value:this._def.catchValue({get error(){return new Nr(r.common.issues)},input:r.data})})):{status:"valid",value:i.status==="valid"?i.value:this._def.catchValue({get error(){return new Nr(r.common.issues)},input:r.data})}}removeCatch(){return this._def.innerType}}Md.create=(t,e)=>new Md({innerType:t,typeName:De.ZodCatch,catchValue:typeof e.catch=="function"?e.catch:()=>e.catch,...Re(e)});class wm extends Fe{_parse(e){if(this._getType(e)!==ve.nan){const r=this._getOrReturnCtx(e);return pe(r,{code:se.invalid_type,expected:ve.nan,received:r.parsedType}),Oe}return{status:"valid",value:e.data}}}wm.create=t=>new wm({typeName:De.ZodNaN,...Re(t)});const Zj=Symbol("zod_brand");class cv extends Fe{_parse(e){const{ctx:n}=this._processInputParams(e),r=n.data;return this._def.type._parse({data:r,path:n.path,parent:n})}unwrap(){return this._def.type}}class hf extends Fe{_parse(e){const{status:n,ctx:r}=this._processInputParams(e);if(r.common.async)return(async()=>{const s=await this._def.in._parseAsync({data:r.data,path:r.path,parent:r});return s.status==="aborted"?Oe:s.status==="dirty"?(n.dirty(),gc(s.value)):this._def.out._parseAsync({data:s.value,path:r.path,parent:r})})();{const i=this._def.in._parseSync({data:r.data,path:r.path,parent:r});return i.status==="aborted"?Oe:i.status==="dirty"?(n.dirty(),{status:"dirty",value:i.value}):this._def.out._parseSync({data:i.value,path:r.path,parent:r})}}static create(e,n){return new hf({in:e,out:n,typeName:De.ZodPipeline})}}class Id extends Fe{_parse(e){const n=this._def.innerType._parse(e),r=i=>(_d(i)&&(i.value=Object.freeze(i.value)),i);return bd(n)?n.then(i=>r(i)):r(n)}unwrap(){return this._def.innerType}}Id.create=(t,e)=>new Id({innerType:t,typeName:De.ZodReadonly,...Re(e)});function DT(t,e={},n){return t?Kc.create().superRefine((r,i)=>{var s,a;if(!t(r)){const o=typeof e=="function"?e(r):typeof e=="string"?{message:e}:e,l=(a=(s=o.fatal)!==null&&s!==void 0?s:n)!==null&&a!==void 0?a:!0,c=typeof o=="string"?{message:o}:o;i.addIssue({code:"custom",...c,fatal:l})}}):Kc.create()}const Xj={object:Mt.lazycreate};var De;(function(t){t.ZodString="ZodString",t.ZodNumber="ZodNumber",t.ZodNaN="ZodNaN",t.ZodBigInt="ZodBigInt",t.ZodBoolean="ZodBoolean",t.ZodDate="ZodDate",t.ZodSymbol="ZodSymbol",t.ZodUndefined="ZodUndefined",t.ZodNull="ZodNull",t.ZodAny="ZodAny",t.ZodUnknown="ZodUnknown",t.ZodNever="ZodNever",t.ZodVoid="ZodVoid",t.ZodArray="ZodArray",t.ZodObject="ZodObject",t.ZodUnion="ZodUnion",t.ZodDiscriminatedUnion="ZodDiscriminatedUnion",t.ZodIntersection="ZodIntersection",t.ZodTuple="ZodTuple",t.ZodRecord="ZodRecord",t.ZodMap="ZodMap",t.ZodSet="ZodSet",t.ZodFunction="ZodFunction",t.ZodLazy="ZodLazy",t.ZodLiteral="ZodLiteral",t.ZodEnum="ZodEnum",t.ZodEffects="ZodEffects",t.ZodNativeEnum="ZodNativeEnum",t.ZodOptional="ZodOptional",t.ZodNullable="ZodNullable",t.ZodDefault="ZodDefault",t.ZodCatch="ZodCatch",t.ZodPromise="ZodPromise",t.ZodBranded="ZodBranded",t.ZodPipeline="ZodPipeline",t.ZodReadonly="ZodReadonly"})(De||(De={}));const Jj=(t,e={message:`Input not instance of ${t.name}`})=>DT(n=>n instanceof t,e),OT=Mi.create,MT=ho.create,eF=wm.create,tF=po.create,IT=wd.create,nF=bl.create,rF=xm.create,iF=Ed.create,sF=kd.create,aF=Kc.create,oF=cl.create,lF=oa.create,cF=_m.create,uF=Pi.create,dF=Mt.create,fF=Mt.strictCreate,hF=Cd.create,pF=A0.create,mF=Td.create,gF=ws.create,yF=Sd.create,vF=bm.create,xF=wl.create,_F=Oc.create,bF=Nd.create,wF=Ad.create,EF=mo.create,kF=Dd.create,CF=qc.create,E8=Fi.create,TF=fs.create,SF=go.create,NF=Fi.createWithPreprocess,AF=hf.create,DF=()=>OT().optional(),OF=()=>MT().optional(),MF=()=>IT().optional(),IF={string:t=>Mi.create({...t,coerce:!0}),number:t=>ho.create({...t,coerce:!0}),boolean:t=>wd.create({...t,coerce:!0}),bigint:t=>po.create({...t,coerce:!0}),date:t=>bl.create({...t,coerce:!0})},LF=Oe;var E=Object.freeze({__proto__:null,defaultErrorMap:Gc,setErrorMap:Lj,getErrorMap:gm,makeIssue:ym,EMPTY_PATH:Pj,addIssueToContext:pe,ParseStatus:Rn,INVALID:Oe,DIRTY:gc,OK:Gn,isAborted:O4,isDirty:M4,isValid:_d,isAsync:bd,get util(){return Je},get objectUtil(){return D4},ZodParsedType:ve,getParsedType:Fa,ZodType:Fe,datetimeRegex:NT,ZodString:Mi,ZodNumber:ho,ZodBigInt:po,ZodBoolean:wd,ZodDate:bl,ZodSymbol:xm,ZodUndefined:Ed,ZodNull:kd,ZodAny:Kc,ZodUnknown:cl,ZodNever:oa,ZodVoid:_m,ZodArray:Pi,ZodObject:Mt,ZodUnion:Cd,ZodDiscriminatedUnion:A0,ZodIntersection:Td,ZodTuple:ws,ZodRecord:Sd,ZodMap:bm,ZodSet:wl,ZodFunction:Oc,ZodLazy:Nd,ZodLiteral:Ad,ZodEnum:mo,ZodNativeEnum:Dd,ZodPromise:qc,ZodEffects:Fi,ZodTransformer:Fi,ZodOptional:fs,ZodNullable:go,ZodDefault:Od,ZodCatch:Md,ZodNaN:wm,BRAND:Zj,ZodBranded:cv,ZodPipeline:hf,ZodReadonly:Id,custom:DT,Schema:Fe,ZodSchema:Fe,late:Xj,get ZodFirstPartyTypeKind(){return De},coerce:IF,any:aF,array:uF,bigint:tF,boolean:IT,date:nF,discriminatedUnion:pF,effect:E8,enum:EF,function:_F,instanceof:Jj,intersection:mF,lazy:bF,literal:wF,map:vF,nan:eF,nativeEnum:kF,never:lF,null:sF,nullable:SF,number:MT,object:dF,oboolean:MF,onumber:OF,optional:TF,ostring:DF,pipeline:AF,preprocess:NF,promise:CF,record:yF,set:xF,strictObject:fF,string:OT,symbol:rF,transformer:E8,tuple:gF,undefined:iF,union:hF,unknown:oF,void:cF,NEVER:LF,ZodIssueCode:se,quotelessJson:Ij,ZodError:Nr});const PF=E.object({origin:E.union([E.string(),E.array(E.string())]),allowMethods:E.array(E.string()).optional(),allowHeaders:E.array(E.string()).optional(),exposeHeaders:E.array(E.string()).optional(),maxAge:E.number().optional(),credentials:E.boolean().optional()}),RF=E.object({message:E.string().optional(),code:E.string().optional(),expected:E.string().optional(),received:E.string().optional(),path:E.array(E.string()).optional()});E.object({messages:E.array(RF).optional()});const rh=E.string(),ih=E.string(),uv=E.object({created_at:E.string().optional().describe("ISO string creation time"),updated_at:E.string().optional().describe("ISO string update time")}).describe("Timestamps");E.object({search:E.array(E.string()).optional()}).describe("searchable");const jF=E.object({id:E.string().optional().describe("ID")}).describe("with `id`"),FF=E.object({id:E.string().describe("ID")}).describe("with `id`"),ui=E.object({id:E.string().optional().describe("Optional `id`"),handle:E.string().optional().describe("Optional `handle`")}),BF=E.object({key:E.string().describe("The key"),value:E.string().optional().describe("The value")}).describe("Attribute type, a key/value storage"),HF=E.object({iss:E.string(),sub:E.string(),aud:E.string(),exp:E.number(),nbf:E.number(),iat:E.number(),jti:E.string(),roles:E.array(E.string()).describe("User roles and authorizations")}),dv=E.object({email:E.string().email().describe("Email of user"),password:E.string().min(4).max(20).describe("password")}).describe("Auth base type"),zF=E.union([E.literal("admin"),E.literal("user"),E.string()]).describe("Role of authenticated user");dv.describe("Sign in type");dv.and(E.object({firstname:E.string().optional().describe("(optional) readable `name` of `customer`"),lastname:E.string().optional().describe("(optional) readable `name` of `customer`")})).describe("Sign up type");E.object({user_id_or_email:E.string().describe("User `ID` or `Email`"),current_password:E.string().describe("Current password"),new_password:E.string().describe("New password"),confirm_new_password:E.string().describe("Again New password for confirmation")}).describe("Change Password Type");E.object({refresh_token:E.string().describe("A refresh token")}).describe("Refresh token input type");const k8=E.object({token:E.string().describe("a token (`access` or `refresh`)"),claims:HF.partial().describe("Claims the `JSON Web Token` holds")}).describe("API token with parsed claims");E.object({apikey:E.string().describe("The `apikey` is `base64_uri(apikey@storecraft.api:{password})`.\nIt will be shown only once to the user, at the `backend`, the password hash\nwill be saved, thus, the real password is only known to the user.")}).describe("Result of `auth` `apikey` creation");E.object({token_type:E.string().describe("The type of token, should be `bearer` or `refresh`"),user_id:E.string().describe("the `ID` of user, example `au_....`"),access_token:k8.describe("The access token"),refresh_token:k8.describe("The refresh token")}).describe("Result of `auth` request for `signin` / `signup` / `refresh`");const Hi=FF.extend(uv.shape).extend({media:E.array(E.string()).optional().describe("List of images urls"),attributes:E.array(BF).optional().describe("List of attributes"),tags:E.array(E.string()).optional().describe("List of tags , example ['genere_action', 'rated_M', ...]"),description:E.string().optional().describe("Rich description"),active:E.boolean().optional().describe("Is the entity active ?")}),UF=jF.extend(uv.shape).extend({handle:E.string().describe("The key name"),values:E.array(E.string()).describe("List of values, related to the key")});UF.omit({id:!0,handle:!0}).and(ui).describe("Tag upsert type");const fv=Hi.extend({handle:E.string().describe("The `handle` of the entity"),title:E.string().min(3,"Title should be longer than 3").describe("Title of collection"),active:E.boolean().describe("Is the entity active ?"),published:E.string().optional().describe(`Collections can be exported into
171
171
  json with products, this is the url`)});fv.omit({id:!0,handle:!0}).and(ui).describe("Collection upsert type");const LT=E.object({option_id:E.string().describe("Variant option id"),value_id:E.string().describe("Variant selected value id")}).describe("Variant option selection type"),$F=E.object({id:E.string().describe("The `id` of the entity"),value:E.string().describe("The text value of the entity")}).describe("Identifiable text entity type"),Zo=E.object({id:E.string().describe("The `id` of the entity"),handle:E.string().describe("The `handle` of the entity")}).describe("both `id` and `handle` of entity required"),VF=E.object({name:E.string().min(3,"Name should be longer than 3").describe("Variant option name (for example 'Size')"),id:E.string().describe("Variant option id"),values:E.array($F).describe("Variant option values\n(for example `Small` / `Medium` / `Large` ..)")}).describe("The data of a variant option"),C8=E.object({Auto:E.object({id:E.literal(0),name:E.string().optional(),name2:E.literal("automatic")}),Manual:E.object({id:E.literal(1),name:E.string().optional(),name2:E.literal("manual")})}).describe(`Discounts can be manual(coupon) or automatic types,
172
172
  see <a href='#DiscountApplicationEnum'>#DiscountApplicationEnum</a>`),PT=E.array(E.object({id:E.string().optional().describe("`p_in_collections` filter, `id` of collection"),title:E.string().optional().describe("`p_in_collections` filter, `title` of collection"),handle:E.string().optional().describe("`p_in_collections` filter, `handle` of the collection")})).describe("Filter for product in collections"),YF=PT.describe("Filter for product not in collections"),RT=E.array(E.object({id:E.string().optional().describe("`p_in_products` filter, `id` of `product`"),title:E.string().optional().describe("`p_in_products` filter, `title` of `product`"),handle:E.string().optional().describe("`p_in_products` filter, `handle` of the `product`")})).describe("Filter for product discount, product in handles"),WF=RT.describe("Filter for product discount, product not in handles"),GF=E.array(E.string()).describe("Filter for product discount, product has tags"),KF=E.array(E.string()).describe("Filter for product discount, NOT has tags");E.object({}).describe(`Filter for product discount,
173
- that chooses all products`);const qF=E.object({from:E.number().optional().describe("`p_in_price_range` filter From price"),to:E.number().describe("`p_in_price_range` filter To price")}).describe("Filter for product discount, product in price range"),QF=E.object({from:E.number().optional().describe("`o_subtotal_in_range` filter From price"),to:E.number().optional().describe("`o_subtotal_in_range` filter To price")}).describe("Filter for order discount, subtotal in range"),ZF=E.object({from:E.number().optional().describe("`o_items_count_in_range` filter From count"),to:E.number().optional().describe("`o_items_count_in_range` filter To count")}).describe("Filter for order discount, items count in range"),XF=E.object({from:E.string().optional().describe("`o_date_in_range` filter From date `ISO` format"),to:E.string().optional().describe("`o_date_in_range` filter To date `ISO` format")}).describe("Filter for order discount, subtotal in range"),JF=E.array(E.object({id:E.string().describe("`id` of `customer`"),email:E.string().optional().describe("(optional) `email` of `customer`"),firstname:E.string().optional().describe("(optional) readable `name` of `customer`"),lastname:E.string().optional().describe("(optional) readable `name` of `customer`")})).describe("Filter for order discount, order has customer id"),gr=E.object({any:E.object({id:E.number().optional(),type:E.string().optional(),op:E.string().optional(),name:E.string().optional()}),p_in_collections:E.object({id:E.literal(0),type:E.literal("product"),op:E.literal("p-in-collections"),name:E.string().optional()}),p_not_in_collections:E.object({id:E.literal(1),type:E.literal("product"),op:E.literal("p-not-in-collections"),name:E.string().optional()}),p_in_products:E.object({id:E.literal(2),type:E.literal("product"),op:E.literal("p-in-products"),name:E.string().optional()}),p_not_in_products:E.object({id:E.literal(3),type:E.literal("product"),op:E.literal("p-not-in-products"),name:E.string().optional()}),p_in_tags:E.object({id:E.literal(4),type:E.literal("product"),op:E.literal("p-in-tags"),name:E.string().optional()}),p_not_in_tags:E.object({id:E.literal(5),type:E.literal("product"),op:E.literal("p-not-in-tags"),name:E.string().optional()}),p_all:E.object({id:E.literal(6),type:E.literal("product"),op:E.literal("p-all"),name:E.string().optional()}),p_in_price_range:E.object({id:E.literal(7),type:E.literal("product"),op:E.literal("p-in-price-range"),name:E.string().optional()}),o_subtotal_in_range:E.object({id:E.literal(100),type:E.literal("order"),op:E.literal("o-subtotal-in-range"),name:E.string().optional()}),o_items_count_in_range:E.object({id:E.literal(101),type:E.literal("order"),op:E.literal("o-items-count-in-range"),name:E.string().optional()}),o_date_in_range:E.object({id:E.literal(102),type:E.literal("order"),op:E.literal("o-date-in-range"),name:E.string().optional()}),o_has_customer:E.object({id:E.literal(103),type:E.literal("order"),op:E.literal("o-has-customer"),name:E.string().optional()})}),$l=E.object({regular:E.object({id:E.literal(0),type:E.literal("regular"),name:E.string().optional()}),bulk:E.object({id:E.literal(1),type:E.literal("bulk"),name:E.string().optional()}),buy_x_get_y:E.object({id:E.literal(2),type:E.literal("buy_x_get_y"),name:E.string().optional()}),order:E.object({id:E.literal(3),type:E.literal("order"),name:E.string().optional()}),bundle:E.object({id:E.literal(4),type:E.literal("bundle"),name:E.string().optional()}),any:E.object({id:E.number().optional(),type:E.string().optional(),name:E.string().optional()})}).describe(`Discount meta data,
174
- see <a href='#DiscountMetaEnum'>#DiscountMetaEnum</a>`),eB=E.object({fixed:E.number().describe("`RegularDiscountExtra` params, Fixed price addition"),percent:E.number().describe("`RegularDiscountExtra` params, Percents off")}).describe("Parameters of a regular discount"),tB=E.object({fixed:E.number().describe("`OrderDiscountExtra` params, Fixed price addition"),percent:E.number().describe("`OrderDiscountExtra` params, Percents off"),free_shipping:E.boolean().optional().describe("`OrderDiscountExtra` params, Do we have free shipping ?")}).describe("Parameters of order discount"),nB=E.object({fixed:E.number().describe("`BulkDiscountExtra` params, Fixed price addition"),percent:E.number().describe("`BulkDiscountExtra` params, Percents off"),qty:E.number().describe("`BulkDiscountExtra` params, The integer quantity\nfor which the discount is given"),recursive:E.boolean().optional().describe("`BulkDiscountExtra` params, Apply the discount as\nmany times as possible")}).describe("Parameters of bulk discount"),rB=E.object({fixed:E.number().describe("`BundleDiscountExtra` params, Fixed price addition"),percent:E.number().describe("`BundleDiscountExtra` params, Percents off"),recursive:E.boolean().optional().describe("`BundleDiscountExtra` params, Apply the discount\nas many times as possible")}).describe("Parameters of bulk discount"),jT=E.object({meta:E.union([gr.shape.p_all,gr.shape.p_in_collections,gr.shape.p_not_in_collections,gr.shape.p_in_tags,gr.shape.p_not_in_tags,gr.shape.p_in_products,gr.shape.p_not_in_products,gr.shape.p_in_price_range,gr.shape.o_date_in_range,gr.shape.o_has_customer,gr.shape.o_items_count_in_range,gr.shape.o_subtotal_in_range,gr.shape.any]).describe("Meta data related to identifying the filter"),value:E.union([PT,YF,RT,WF,GF,KF,qF,QF,ZF,XF,JF]).optional().describe("The filter params")}).describe("Discount filter schema"),D0=Hi.extend({price:E.number().min(0,"Please set a price >= 0").describe("Shipping method price"),title:E.string().min(3,"Title should be longer than 3").describe("Name of shipping method"),handle:E.string().describe("Readable `handle` of shipping")}),FT=Hi.extend({handle:E.string().describe("Unique `handle`"),title:E.string().min(3,"Title should be longer than 3").describe("Title of post"),text:E.string().describe("Rich text of post")}),BT=E.object({firstname:E.string().optional().describe("First name of recipient"),lastname:E.string().optional().describe("Last name of recipient"),phone_number:E.string().regex(/^([+]?d{1,2}[-s]?|)d{3}[-s]?d{3}[-s]?d{4}$ Invalid phone number/).optional().describe("The phone number of the recipient"),company:E.string().optional().describe("Optional company name of recipient"),street1:E.string().optional().describe("Street address 1"),street2:E.string().optional().describe("Street address 2"),city:E.string().optional().describe("City"),country:E.string().optional().describe("Country"),state:E.string().optional().describe("State"),zip_code:E.string().optional().describe("ZIP code"),postal_code:E.string().optional().describe("Postal code")}).describe("Address type"),iB=Hi.extend({auth_id:E.string().optional().describe("The `auth id` of the customer. it is the same as\ncustomer `id` with `au` prefix instead"),firstname:E.string().min(1,"Should be longer than 1 characters").optional().describe("Firstname"),lastname:E.string().min(1,"Should be longer than 1 characters").optional().describe("Lastname"),email:E.string().email().describe("Email of customer"),phone_number:E.string().regex(/^([+]?d{1,2}[-s]?|)d{3}[-s]?d{3}[-s]?d{4}$/).optional().describe("The phone number"),address:BT.optional().describe("Address info of customer")});iB.omit({id:!0,handle:!0}).and(ui).describe("Customer upsert type");const sB=Hi.extend({handle:E.string().describe("Unique handle"),name:E.string().min(1,"Should be longer than 1 characters").describe("Name"),url:E.string().min(1,"Should be longer than 1 characters").describe("It's published public url"),usage:E.array(E.string()).optional().describe("List of assets using this image")});sB.omit({id:!0,handle:!0}).and(ui).describe("Image upsert type");D0.omit({id:!0,handle:!0}).and(ui).describe("Shipping upsert type");FT.omit({id:!0,handle:!0}).and(ui).describe("Post upsert type");const aB=E.union([E.literal("route"),E.literal("url")]).describe("'route' means routing inside admin panel 'url' is linking to a url"),oB=E.object({collection:E.string().describe("Which collection"),document:E.string().describe("Which document")}).describe("route inside admin panel action params"),lB=E.object({new_window:E.boolean().optional().describe("Ppen the url in new window"),url:E.string().describe("The url to open")}).describe("Action params for actions of type 'url'"),cB=E.object({firstname:E.string().optional().describe("First name"),lastname:E.string().optional().describe("Last name"),phone_number:E.string().optional().describe("Phone number"),email:E.string().optional().describe("Email"),customer_id:E.string().optional().describe("Customer `id`")}).describe("Order buyer info"),uB=E.object({id:E.string().describe("`id`"),title:E.string().min(3,"Title should be longer than 3").optional().describe("title"),message:E.union([E.literal("shipping-method-not-found"),E.literal("product-not-exists"),E.literal("product-out-of-stock"),E.literal("product-not-enough-stock"),E.literal("product-inactive")]).optional().describe("message")}).describe(`Checkouts or draft orders might be validated
173
+ that chooses all products`);const qF=E.object({from:E.number().optional().describe("`p_in_price_range` filter From price"),to:E.number().describe("`p_in_price_range` filter To price")}).describe("Filter for product discount, product in price range"),QF=E.object({from:E.number().optional().describe("`o_subtotal_in_range` filter From price"),to:E.number().optional().describe("`o_subtotal_in_range` filter To price")}).describe("Filter for order discount, subtotal in range"),ZF=E.object({from:E.number().optional().describe("`o_items_count_in_range` filter From count"),to:E.number().optional().describe("`o_items_count_in_range` filter To count")}).describe("Filter for order discount, items count in range"),XF=E.object({from:E.string().optional().describe("`o_date_in_range` filter From date `ISO` format"),to:E.string().optional().describe("`o_date_in_range` filter To date `ISO` format")}).describe("Filter for order discount, subtotal in range"),JF=E.array(E.object({id:E.string().describe("`id` of `customer`"),email:E.string().optional().describe("(optional) `email` of `customer`"),firstname:E.string().optional().describe("(optional) readable `name` of `customer`"),lastname:E.string().optional().describe("(optional) readable `name` of `customer`")})).describe("Filter for order discount, order has customer id"),gr=E.object({any:E.object({id:E.number().optional(),type:E.string().optional(),op:E.string().optional(),name:E.string().optional()}),p_in_collections:E.object({id:E.literal(0),type:E.literal("product"),op:E.literal("p-in-collections"),name:E.string().optional()}),p_not_in_collections:E.object({id:E.literal(1),type:E.literal("product"),op:E.literal("p-not-in-collections"),name:E.string().optional()}),p_in_products:E.object({id:E.literal(2),type:E.literal("product"),op:E.literal("p-in-products"),name:E.string().optional()}),p_not_in_products:E.object({id:E.literal(3),type:E.literal("product"),op:E.literal("p-not-in-products"),name:E.string().optional()}),p_in_tags:E.object({id:E.literal(4),type:E.literal("product"),op:E.literal("p-in-tags"),name:E.string().optional()}),p_not_in_tags:E.object({id:E.literal(5),type:E.literal("product"),op:E.literal("p-not-in-tags"),name:E.string().optional()}),p_all:E.object({id:E.literal(6),type:E.literal("product"),op:E.literal("p-all"),name:E.string().optional()}),p_in_price_range:E.object({id:E.literal(7),type:E.literal("product"),op:E.literal("p-in-price-range"),name:E.string().optional()}),o_subtotal_in_range:E.object({id:E.literal(100),type:E.literal("order"),op:E.literal("o-subtotal-in-range"),name:E.string().optional()}),o_items_count_in_range:E.object({id:E.literal(101),type:E.literal("order"),op:E.literal("o-items-count-in-range"),name:E.string().optional()}),o_date_in_range:E.object({id:E.literal(102),type:E.literal("order"),op:E.literal("o-date-in-range"),name:E.string().optional()}),o_has_customer:E.object({id:E.literal(103),type:E.literal("order"),op:E.literal("o-has-customer"),name:E.string().optional()})}),$l=E.object({regular:E.object({id:E.literal(0),type:E.literal("regular"),name:E.string().optional()}),bulk:E.object({id:E.literal(1),type:E.literal("bulk"),name:E.string().optional()}),buy_x_get_y:E.object({id:E.literal(2),type:E.literal("buy_x_get_y"),name:E.string().optional()}),order:E.object({id:E.literal(3),type:E.literal("order"),name:E.string().optional()}),bundle:E.object({id:E.literal(4),type:E.literal("bundle"),name:E.string().optional()}),any:E.object({id:E.number().optional(),type:E.string().optional(),name:E.string().optional()})}).describe("Discount meta data,"),eB=E.object({fixed:E.number().describe("`RegularDiscountExtra` params, Fixed price addition"),percent:E.number().describe("`RegularDiscountExtra` params, Percents off")}).describe("Parameters of a regular discount"),tB=E.object({fixed:E.number().describe("`OrderDiscountExtra` params, Fixed price addition"),percent:E.number().describe("`OrderDiscountExtra` params, Percents off"),free_shipping:E.boolean().optional().describe("`OrderDiscountExtra` params, Do we have free shipping ?")}).describe("Parameters of order discount"),nB=E.object({fixed:E.number().describe("`BulkDiscountExtra` params, Fixed price addition"),percent:E.number().describe("`BulkDiscountExtra` params, Percents off"),qty:E.number().describe("`BulkDiscountExtra` params, The integer quantity\nfor which the discount is given"),recursive:E.boolean().optional().describe("`BulkDiscountExtra` params, Apply the discount as\nmany times as possible")}).describe("Parameters of bulk discount"),rB=E.object({fixed:E.number().describe("`BundleDiscountExtra` params, Fixed price addition"),percent:E.number().describe("`BundleDiscountExtra` params, Percents off"),recursive:E.boolean().optional().describe("`BundleDiscountExtra` params, Apply the discount\nas many times as possible")}).describe("Parameters of bulk discount"),jT=E.object({meta:E.union([gr.shape.p_all,gr.shape.p_in_collections,gr.shape.p_not_in_collections,gr.shape.p_in_tags,gr.shape.p_not_in_tags,gr.shape.p_in_products,gr.shape.p_not_in_products,gr.shape.p_in_price_range,gr.shape.o_date_in_range,gr.shape.o_has_customer,gr.shape.o_items_count_in_range,gr.shape.o_subtotal_in_range,gr.shape.any]).describe("Meta data related to identifying the filter"),value:E.union([PT,YF,RT,WF,GF,KF,qF,QF,ZF,XF,JF]).optional().describe("The filter params")}).describe("Discount filter schema"),D0=Hi.extend({price:E.number().min(0,"Please set a price >= 0").describe("Shipping method price"),title:E.string().min(3,"Title should be longer than 3").describe("Name of shipping method"),handle:E.string().describe("Readable `handle` of shipping")}),FT=Hi.extend({handle:E.string().describe("Unique `handle`"),title:E.string().min(3,"Title should be longer than 3").describe("Title of post"),text:E.string().describe("Rich text of post")}),BT=E.object({firstname:E.string().optional().describe("First name of recipient"),lastname:E.string().optional().describe("Last name of recipient"),phone_number:E.string().regex(/^([+]?d{1,2}[-s]?|)d{3}[-s]?d{3}[-s]?d{4}$ Invalid phone number/).optional().describe("The phone number of the recipient"),company:E.string().optional().describe("Optional company name of recipient"),street1:E.string().optional().describe("Street address 1"),street2:E.string().optional().describe("Street address 2"),city:E.string().optional().describe("City"),country:E.string().optional().describe("Country"),state:E.string().optional().describe("State"),zip_code:E.string().optional().describe("ZIP code"),postal_code:E.string().optional().describe("Postal code")}).describe("Address type"),iB=Hi.extend({auth_id:E.string().optional().describe("The `auth id` of the customer. it is the same as\ncustomer `id` with `au` prefix instead"),firstname:E.string().min(1,"Should be longer than 1 characters").optional().describe("Firstname"),lastname:E.string().min(1,"Should be longer than 1 characters").optional().describe("Lastname"),email:E.string().email().describe("Email of customer"),phone_number:E.string().regex(/^([+]?d{1,2}[-s]?|)d{3}[-s]?d{3}[-s]?d{4}$/).optional().describe("The phone number"),address:BT.optional().describe("Address info of customer")});iB.omit({id:!0,handle:!0}).and(ui).describe("Customer upsert type");const sB=Hi.extend({handle:E.string().describe("Unique handle"),name:E.string().min(1,"Should be longer than 1 characters").describe("Name"),url:E.string().min(1,"Should be longer than 1 characters").describe("It's published public url"),usage:E.array(E.string()).optional().describe("List of assets using this image")});sB.omit({id:!0,handle:!0}).and(ui).describe("Image upsert type");D0.omit({id:!0,handle:!0}).and(ui).describe("Shipping upsert type");FT.omit({id:!0,handle:!0}).and(ui).describe("Post upsert type");const aB=E.union([E.literal("route"),E.literal("url")]).describe("'route' means routing inside admin panel 'url' is linking to a url"),oB=E.object({collection:E.string().describe("Which collection"),document:E.string().describe("Which document")}).describe("route inside admin panel action params"),lB=E.object({new_window:E.boolean().optional().describe("Ppen the url in new window"),url:E.string().describe("The url to open")}).describe("Action params for actions of type 'url'"),cB=E.object({firstname:E.string().optional().describe("First name"),lastname:E.string().optional().describe("Last name"),phone_number:E.string().optional().describe("Phone number"),email:E.string().optional().describe("Email"),customer_id:E.string().optional().describe("Customer `id`")}).describe("Order buyer info"),uB=E.object({id:E.string().describe("`id`"),title:E.string().min(3,"Title should be longer than 3").optional().describe("title"),message:E.union([E.literal("shipping-method-not-found"),E.literal("product-not-exists"),E.literal("product-out-of-stock"),E.literal("product-not-enough-stock"),E.literal("product-inactive")]).optional().describe("message")}).describe(`Checkouts or draft orders might be validated
175
174
  in automatic systems`),zu=E.object({created:E.object({id:E.literal(0),name2:E.literal("created"),name:E.string().optional()}),requires_action:E.object({id:E.literal(1),name2:E.literal("requires_action"),name:E.string().optional()}),failed:E.object({id:E.literal(2),name2:E.literal("failed"),name:E.string().optional()}),complete:E.object({id:E.literal(3),name2:E.literal("complete"),name:E.string().optional()}),unknown:E.object({id:E.literal(4),name2:E.literal("unknown"),name:E.string().optional()})}).describe(`Checkout status encapsulate the current state,
176
175
  see <a href='#CheckoutStatusEnum'>#CheckoutStatusEnum</a>`),Ls=E.object({unpaid:E.object({id:E.literal(0),name:E.string().optional(),name2:E.literal("unpaid")}),authorized:E.object({id:E.literal(1),name:E.string().optional(),name2:E.literal("authorized")}),captured:E.object({id:E.literal(2),name:E.string().optional(),name2:E.literal("captured")}),requires_auth:E.object({id:E.literal(3),name:E.string().optional(),name2:E.literal("requires_auth")}),voided:E.object({id:E.literal(4),name:E.string().optional(),name2:E.literal("voided")}),failed:E.object({id:E.literal(5),name:E.string().optional(),name2:E.literal("failed")}),partially_paid:E.object({id:E.literal(6),name:E.string().optional(),name2:E.literal("partially_paid")}),refunded:E.object({id:E.literal(7),name:E.string().optional(),name2:E.literal("refunded")}),partially_refunded:E.object({id:E.literal(8),name:E.string().optional(),name2:E.literal("partially_refunded")}),cancelled:E.object({id:E.literal(9),name:E.string().optional(),name2:E.literal("cancelled")})}).describe(`Payment options encapsulate the current state,
177
176
  see <a href='#PaymentOptionsEnum'>#PaymentOptionsEnum</a>`),Uu=E.object({draft:E.object({id:E.literal(0),name2:E.literal("draft"),name:E.string().optional()}),processing:E.object({id:E.literal(1),name2:E.literal("processing"),name:E.string().optional()}),shipped:E.object({id:E.literal(2),name2:E.literal("shipped"),name:E.string().optional()}),fulfilled:E.object({id:E.literal(3),name2:E.literal("fulfilled"),name:E.string().optional()}),cancelled:E.object({id:E.literal(4),name2:E.literal("cancelled"),name:E.string().optional()})}).describe(`Fulfillment options encapsulate the current state,
@@ -203,7 +202,7 @@ to discount line items`);E.object({selection:E.array(LT).describe("A list of sel
203
202
  this is an explicit connection, to form a better UX experience`),related_products:E.array(Qc.pick({id:!0,handle:!0})).optional().describe(`List of related products to add the product into,
204
203
  this is an explicit connection, to form a better UX experience`)})).and(ui).describe("Variant upsert type");const OB=E.object({evo:E.array(DB).optional().describe("Explanation of how discounts stack and change pricing"),shipping_method:D0.partial().optional().describe("Selected shipping method"),taxes:E.array(dB).optional().describe("The taxes collected from the sale"),subtotal_undiscounted:E.number().describe("Subtotal of items price before discounts"),subtotal_discount:E.number().describe("Sum of all discounts at all stages"),subtotal:E.number().describe("`subtotal_undiscounted` - `subtotal_discount`"),total_without_taxes:E.number().optional().describe("`subtotal` + `shipping`"),total:E.number().describe("`subtotal` + `shipping` + `taxes`"),quantity_total:E.number().describe("How many items are eligible"),quantity_discounted:E.number().describe("How many items were discounted"),uid:E.string().optional().describe("Authentication user id"),errors:E.array(fB).optional().describe("Errors")}).describe(`Pricing object exaplins how the pricing of an order
205
204
  was calculated given a stack of automatic discounts, coupons,
206
- line items and shipping method`),MB=AB.extend(Hi.shape).extend({status:wB.describe("Status of `checkout`, `fulfillment` and `payment`"),pricing:OB.describe("Pricing information"),validation:E.array(uB).optional().describe("In case the order went through validation"),payment_gateway:EB.optional().describe("Payment gateway info and status")});MB.omit({id:!0}).and(ui).describe("Order upsert type");const Zc={Auto:{id:0,name:"Automatic",name2:"automatic"},Manual:{id:1,name:"Manual",name2:"manual"}},Qt={any:{},p_in_collections:{id:0,type:"product",op:"p-in-collections",name:"Product In Collection"},p_not_in_collections:{id:1,type:"product",op:"p-not-in-collections",name:"Product not in Collection"},p_in_products:{id:2,type:"product",op:"p-in-products",name:"Product belongs to"},p_not_in_products:{id:3,type:"product",op:"p-not-in-products",name:"Product does not belong to"},p_in_tags:{id:4,type:"product",op:"p-in-tags",name:"Product has Tag"},p_not_in_tags:{id:5,type:"product",op:"p-not-in-tags",name:"Product excludes Tag"},p_all:{id:6,type:"product",op:"p-all",name:"All Products"},p_in_price_range:{id:7,type:"product",op:"p-in-price-range",name:"Product in Price range"},o_subtotal_in_range:{id:100,type:"order",op:"o-subtotal-in-range",name:"Order subtotal in range"},o_items_count_in_range:{id:101,type:"order",op:"o-items-count-in-range",name:"Order items count in range"},o_date_in_range:{id:102,type:"order",op:"o-date-in-range",name:"Order in dates"},o_has_customer:{id:103,type:"order",op:"o-has-customer",name:"Order has Customers"}},Er={any:{},regular:{id:0,type:"regular",name:"Regular Discount"},bulk:{id:1,type:"bulk",name:"Bulk Discount"},buy_x_get_y:{id:2,type:"buy_x_get_y",name:"Buy X Get Y"},order:{id:3,type:"order",name:"Order Discount"},bundle:{id:4,type:"bundle",name:"Bundle Discount"}},T8={created:{id:0,name2:"created",name:"Created"},requires_action:{id:1,name2:"requires_action",name:"Requires Action"},failed:{id:2,name2:"failed",name:"Failed"},complete:{id:3,name2:"complete",name:"Complete"},unknown:{id:4,name2:"unknown",name:"Unknown"}},P4={draft:{id:0,name2:"draft",name:"Draft"},processing:{id:1,name2:"processing",name:"Processing (Stock Reserved)"},shipped:{id:2,name2:"shipped",name:"Shipped"},fulfilled:{id:3,name2:"fulfilled",name:"Fulfilled"},cancelled:{id:4,name2:"cancelled",name:"Cancelled (Stock returned)"}},R4={unpaid:{id:0,name:"Unpaid",name2:"unpaid"},authorized:{id:1,name:"Authorized",name2:"authorized"},captured:{id:2,name:"Captured",name2:"captured"},requires_auth:{id:3,name:"Requires Authentication",name2:"requires_auth"},voided:{id:4,name:"Voided",name2:"voided"},failed:{id:5,name:"Failed",name2:"failed"},partially_paid:{id:6,name:"Partially paid",name2:"partially_paid"},refunded:{id:7,name:"Refunded",name2:"refunded"},partially_refunded:{id:8,name:"Partially Refunded",name2:"partially_refunded"},cancelled:{id:9,name:"Cancelled",name2:"cancelled"}};var Rc,zn,Ba;class IB{constructor(e){$r(this,Rc,new Set);$r(this,zn);ee(this,"notify_subscribers",()=>{for(let e of ct(this,Rc))e({auth:this.currentAuth,isAuthenticated:this.isAuthenticated})});ee(this,"add_sub",e=>(ct(this,Rc).add(e),()=>{ct(this,Rc).delete(e)}));$r(this,Ba,e=>{this.currentAuth=e,this.notify_subscribers()});ee(this,"signin",async(e,n)=>{const r={email:e,password:n},i=await fetch(p1(ct(this,zn).config,"/auth/signin"),{method:"post",body:JSON.stringify(r),headers:{"Content-Type":"application/json"}});if(!i.ok){let a={messages:[{message:"auth/error"}]};try{a=await i.json()}catch{}throw a}const s=await i.json();return ct(this,Ba).call(this,s),s});ee(this,"signup",async(e,n,r,i)=>{const s={email:e,password:n,firstname:r,lastname:i},a=await fetch(p1(ct(this,zn).config,"/auth/signup"),{method:"post",body:JSON.stringify(s),headers:{"Content-Type":"application/json"}});Dj(a.ok,"auth/error");const o=await a.json();return ct(this,Ba).call(this,o),o});ee(this,"changePassword",async e=>{const n=await fetch(p1(ct(this,zn).config,"/auth/change-password"),{method:"post",body:JSON.stringify(e),headers:{"Content-Type":"application/json"}});if(!n.ok){let i={messages:[{message:"auth/error"}]};try{i=await n.json()}catch{}throw i}const r=await n.json();return ct(this,Ba).call(this,r),r});ee(this,"signout",async()=>{console.log("signout"),ct(this,Ba).call(this,void 0)});ee(this,"create_api_key",async()=>(await tn(ct(this,zn),"/auth/apikeys",{method:"post"})).apikey);ee(this,"get_auth_user",async e=>await tn(ct(this,zn),`/auth/users/${e}`,{method:"get"}));ee(this,"remove_auth_user",async e=>tn(ct(this,zn),`/auth/users/${e}`,{method:"delete"}));ee(this,"list_auth_users",async e=>{const n=cs(e);return tn(ct(this,zn),`/auth/users?${n.toString()}`,{method:"get"})});ee(this,"list_api_keys_auth_users",async()=>await tn(ct(this,zn),"/auth/apikeys",{method:"get"}));_a(this,zn,e)}get currentAuth(){var e,n;return(n=(e=ct(this,zn))==null?void 0:e.config)==null?void 0:n.auth}set currentAuth(e){ct(this,zn).config.auth=e}init(){}async working_auth_token(e=!1){if(this.currentAuth){if("apikey"in this.currentAuth)return this.currentAuth.apikey;if("access_token"in this.currentAuth)return(e||!this.isAuthenticated)&&await this.reAuthenticateIfNeeded(e),this.currentAuth.access_token.token}}async reAuthenticateIfNeeded(e=!1){if(this.currentAuth&&!(this.isAuthenticated&&!e)&&"access_token"in this.currentAuth){const n=await fetch(p1(ct(this,zn).config,"/auth/refresh"),{method:"post",body:JSON.stringify({refresh_token:this.currentAuth.refresh_token.token}),headers:{"Content-Type":"application/json"}});let r;return n.ok&&(r=await n.json()),ct(this,Ba).call(this,r),r}}get authStrategy(){if(this.currentAuth){if("apikey"in this.currentAuth)return"apikey";if("access_token"in this.currentAuth)return"jwt"}return"unknown"}get isAuthenticated(){var e,n,r;if(this.currentAuth){if("apikey"in this.currentAuth)return!!this.currentAuth.apikey;if("access_token"in this.currentAuth){const i=(r=(n=(e=this.currentAuth)==null?void 0:e.access_token)==null?void 0:n.claims)==null?void 0:r.exp;return i&&Date.now()<(i-60)*1e3}}return!1}}Rc=new WeakMap,zn=new WeakMap,Ba=new WeakMap;let LB=class extends Rr{constructor(e){super(e,"customers")}},PB=class extends Rr{constructor(e){super(e,"tags")}},RB=class extends Rr{constructor(e){super(e,"templates")}},jB=class extends Rr{constructor(n){super(n,"products");ee(this,"changeStockOfBy",async(n,r)=>(await Ia(this.sdk,`products/${n}?quantityBy=${r}`,{method:"put"})).ok);ee(this,"batchAddProductsToCollection",async(n,r)=>{for(const i of n)await this.upsert({...i,collections:[...i.collections??[],r]})});ee(this,"batchRemoveProductsFromCollection",async(n,r)=>{for(const i of n)await this.upsert({...i,collections:(i.collections??[]).filter(s=>s.id!==r.id)})})}},FB=class extends Rr{constructor(e){super(e,"orders")}},BB=class extends Rr{constructor(e){super(e,"discounts")}},HB=class extends Rr{constructor(n){super(n,"collections");ee(this,"publish",async(n,r=1e3)=>await tn(this.sdk,`collections/${n}/export`,{method:"post"}))}};class zB extends Rr{constructor(e){super(e,"shipping")}}let UB=class extends Rr{constructor(n){super(n,"storefronts");ee(this,"publish",async n=>await tn(this.sdk,`storefronts/${n}/export`,{method:"post"}))}};var tf,nf;class $B{constructor(e){$r(this,tf);$r(this,nf,{});ee(this,"isCacheValid",e=>!1);ee(this,"fromCache",e=>{if(this.isCacheValid(e))return ct(this,nf)[e]});ee(this,"putCache",(e,n)=>{ct(this,nf)[e]=n});ee(this,"orders",async(e,n)=>{const r=new URLSearchParams;return e&&r.set("fromDay",new Date(e).toISOString()),n&&r.set("toDay",new Date(n).toISOString()),tn(this.sdk,`statistics/orders?${r.toString()}`)});ee(this,"countOf",async(e,n)=>{const r=cs(n);return tn(this.sdk,`statistics/count/${e}?${r.toString()}`)});_a(this,tf,e)}get sdk(){return ct(this,tf)}}tf=new WeakMap,nf=new WeakMap;let VB=class extends Rr{constructor(e){super(e,"images")}},YB=class extends Rr{constructor(e){super(e,"posts")}};class WB{constructor(e){ee(this,"create",async(e,n)=>(console.log("input",e),await tn(this.sdk,`checkout/create?gateway=${n}`,{method:"post",body:JSON.stringify(e),headers:{"Content-Type":"application/json"}})));ee(this,"complete",async e=>await tn(this.sdk,`checkout/${e}/complete`,{method:"post"}));ee(this,"pricing",async e=>await tn(this.sdk,"checkout/pricing",{method:"post",body:JSON.stringify(e),headers:{"Content-Type":"application/json"}}));this.sdk=e}}var rf;class GB{constructor(e){$r(this,rf);_a(this,rf,e)}get(e){return Qo(this.sdk,"payments/gateways",e)}list(){return N0(this.sdk,"payments/gateways")}paymentStatusOfOrder(e){return tn(this.sdk,`/payments/status/${e}`,{method:"get"})}invokeAction(e,n){return tn(this.sdk,`/payments/${e}/${n}`,{method:"post"})}get sdk(){return ct(this,rf)}}rf=new WeakMap;let KB=class extends Rr{constructor(e){super(e,"settings")}},qB=class extends Rr{constructor(n){super(n,"notifications");ee(this,"upsertBulk",n=>tn(this.sdk,`${this.base_name}`,{method:"post",body:JSON.stringify(n),headers:{"Content-Type":"application/json"}}));ee(this,"meta",()=>this.get("_meta"))}};var jc;class QB{constructor(e){$r(this,jc,{features:void 0});ee(this,"features",async()=>{if(ct(this,jc).features)return ct(this,jc).features;try{const e=await Ia(this.sdk,"storage",{method:"get"});if(!e.ok)throw new Error;const n=await e.json();return ct(this,jc).features=n,n}catch(e){console.log(e)}return{supports_signed_urls:!1}});ee(this,"getBlobSigned",async e=>{const n=await Ia(this.sdk,`storage/${e}?signed=true`,{method:"get"}),r=n.headers.get("Content-Type");if(!n.ok)throw await n.json();if(r==="application/json"){const i=await n.json();return(await fetch(i.url,{method:i.method,headers:i.headers})).blob()}throw"unknown"});ee(this,"getBlobUnsigned",async e=>{const n=await Ia(this.sdk,`storage/${e}?signed=false`,{method:"get"});if(n.headers.get("Content-Type"),!n.ok)throw await n.json();return n.blob()});ee(this,"getBlob",async e=>(await this.features()).supports_signed_urls?this.getBlobSigned(e):this.getBlobUnsigned(e));ee(this,"getText",e=>this.getBlob(e).then(n=>n.text()));ee(this,"getJson",e=>this.getBlob(e).then(n=>n.text().then(JSON.parse)));ee(this,"getImageObjectURL",e=>this.getBlob(e).then(n=>URL.createObjectURL(n)));ee(this,"getSource",async(e,n=!0)=>{try{if(!e.startsWith("storage://"))return e;const i=e.split("storage://").at(-1),s=await this.getBlob(i);return n?URL.createObjectURL(s):s.text().then(JSON.parse)}catch(r){console.log(r)}return e});ee(this,"putBytesSigned",async(e,n)=>{const r=await Ia(this.sdk,`storage/${e}?signed=true`,{method:"put"}),i=r.headers.get("Content-Type");if(!r.ok)throw await r.json();if(i==="application/json"){const s=await r.json();return(await fetch(s.url,{method:s.method,headers:s.headers,body:n})).ok}throw"unknown"});ee(this,"putBytesUnsigned",async(e,n)=>{const r=await Ia(this.sdk,`storage/${e}?signed=false`,{method:"put",body:n});if(r.headers.get("Content-Type"),!r.ok)throw await r.json();return r.ok});ee(this,"putBytes",async(e,n)=>(await this.features()).supports_signed_urls?this.putBytesSigned(e,n):this.putBytesUnsigned(e,n));ee(this,"delete",async e=>(await Ia(this.sdk,`storage/${e}`,{method:"delete"})).ok);this.sdk=e}}jc=new WeakMap;var Fc;class ZB{constructor(e){$r(this,Fc);_a(this,Fc,e),this.auth=new IB(this),this.storage=new QB(this),this.customers=new LB(this),this.tags=new PB(this),this.templates=new RB(this),this.products=new jB(this),this.orders=new FB(this),this.collections=new HB(this),this.discounts=new BB(this),this.shipping=new zB(this),this.storefronts=new UB(this),this.statistics=new $B(this),this.images=new VB(this),this.posts=new YB(this),this.payments=new GB(this),this.checkout=new WB(this),this.settings=new KB(this),this.notifications=new qB(this)}updateConfig(e){_a(this,Fc,e)}get config(){return ct(this,Fc)}}Fc=new WeakMap;const XB=()=>typeof window<"u",JB=t=>({get:e=>{if(typeof window>"u")return null;const n=t.getItem(e);return n?JSON.parse(n):null},set:(e,n)=>{if(!(typeof window>"u"))try{typeof window<"u"&&t.setItem(e,JSON.stringify(typeof n>"u"?null:n))}catch(r){console.error(`local_storage_adapter ${e} `,r)}},remove:e=>{typeof window<"u"&&t.removeItem(e)}}),Em=JB(XB()?window.localStorage:void 0),YT="storecraft_latest_config",S8=()=>(rs==null?void 0:rs.config)??Em.get(YT);var rs=new ZB;const eH=(t={})=>{Em.set(YT,t)},tH=t=>{rs.updateConfig(t),eH(t)},rn=(t=S8())=>{const[e,n]=_.useState(void 0),r=mu(),i=rs.auth.isAuthenticated,s=_.useCallback(a=>{tH(a),r()},[r]);return _.useEffect(()=>{s(t)},[t]),_.useEffect(()=>{const a=rs.auth.add_sub(({auth:o})=>{s({...rs.config,auth:o})});return rs.auth.reAuthenticateIfNeeded(),a},[]),{config:rs.config??S8(),sdk:rs,isAuthenticated:i,error:e,actions:{updateConfig:s,trigger:r}}},M0=t=>new Promise((e,n)=>{let r=indexedDB.open(t,1);r.onupgradeneeded=function(i){i.target.result.createObjectStore("main")},r.onsuccess=function(i){e(i.target.result)},r.onerror=function(i){n(i.target.errorCode)}}),nH=(t,e="main")=>(n,r)=>new Promise((i,s)=>{M0(t).then(a=>{let c=a.transaction(e,"readwrite").objectStore(e).put(r,n);c.onsuccess=function(u){const d=u.target.result;n===d?i(n):s()},c.onerror=function(u){s(u.target.errorCode)}}).catch(s)}),rH=(t,e="main")=>n=>new Promise((r,i)=>{M0(t).then(s=>{let l=s.transaction(e,"readwrite").objectStore(e).get(n);l.onsuccess=function(c){const u=c.target.result;u?r(u):i()},l.onerror=function(c){i(c.target.errorCode)}}).catch(i)}),iH=(t,e="main")=>n=>new Promise((r,i)=>{M0(t).then(s=>{let l=s.transaction(e,"readwrite").objectStore(e).delete(n);l.onsuccess=function(c){r(n)},l.onerror=function(c){i(c.target.errorCode)}}).catch(i)}),hv=t=>{const[e,n]=_.useState(),[r,i]=_.useState();_.useEffect(()=>{M0(t).then(n).catch(i)},[t]);const s=_.useCallback(async(l,c)=>{try{return await nH(t,"main")(l,c)}catch(u){i(u)}},[]),a=_.useCallback(async l=>{try{return await rH(t,"main")(l)}catch(c){i(c)}},[]),o=_.useCallback(async l=>{try{return await iH(t,"main")(l)}catch(c){i(c)}},[]);return{db:e,error:r,actions:{get:a,put:s,remove:o}}},WT=()=>{const{db:t,error:e,actions:{get:n,put:r,remove:i}}=hv("storecraft_document_cache"),s=_.useCallback(c=>n(c),[n]),a=_.useCallback(async c=>{try{const u=[];c&&"handle"in c&&u.push(r(String(c.handle),c)),c&&"id"in c&&u.push(r(c.id,c)),await Promise.all(u)}catch{}return c.id},[r]),o=_.useCallback(async(c,u)=>{try{await r(c,u)}catch{}return u.id},[r]),l=_.useCallback(c=>{try{return i(c)}catch{}},[i]);return{db:t,error:e,actions:{get:s,put:a,putWithKey:o,remove:l}}},sH=()=>hv("storecraft_misc_cache"),aH=()=>{const{db:t,error:e,actions:{get:n,put:r,remove:i}}=hv("storecraft_query_cache"),s=_.useCallback((l,c)=>{const u=l+"_"+cs(c).toString();return n(u)},[n]),a=_.useCallback((l,c,u)=>{const d=l+"_"+cs(c).toString();return r(d,u)},[r]),o=_.useCallback((l,c)=>{try{const u=l+"_"+cs(c).toString();return i(u)}catch{}},[i]);return{db:t,error:e,actions:{get:s,put:a,remove:o}}},N8=t=>t==="shipping"?"shipping_methods":t,oH=(t,e,n,r)=>e&&!n&&r!==void 0&&r<=0&&t&&!t.vql&&!t.endAt&&!t.endBefore&&!t.startAt&&!t.startAfter,lH=(t,e,n)=>{e.sortBy=e.sortBy??["updated_at","id"];let r=e.startAfter;return async()=>{const s={...e,startAfter:r},a=await N0(t,n,s);return a!=null&&a.length&&(r=s.sortBy.map((o,l)=>{var c;return[o,(c=a.at(-1))==null?void 0:c[o]]})),a}},El={sortBy:["updated_at","id"],order:"desc",limit:5},Co=(t,e=El,n=!0)=>{const{actions:{get:r,put:i}}=aH(),{actions:{get:s,put:a,putWithKey:o,remove:l}}=WT(),{sdk:c}=rn(),u=_.useRef(e),d=_.useRef(!1),h=_.useRef(),[p,m]=_.useState(void 0),[g,y]=_.useState([]),[v,x]=_.useState(-1),[b,w]=_.useState(n),[C,S]=_.useState(!1),[k,N]=_.useState(-1),D=mu();_.useEffect(()=>c.auth.add_sub(D),[D]);const A=_.useCallback(async(R=!1)=>{let z;w(!0);try{z=await h.current();for(let O of z)a(O);R?(x(0),y([[...z]])):(x(O=>O+1),y(O=>[...O,[...z]])),S(!0)}catch(O){m(O==null?void 0:O.code)}finally{w(!1)}return z},[]),L=_.useCallback(R=>{if(!h.current)return Promise.resolve();const z=R?1:-1;return v+z<0?Promise.resolve():v+z<g.length?(x(v+z),Promise.resolve()):A()},[g,v,A]),$=_.useCallback(()=>L(!0),[L]),K=_.useCallback(()=>L(!1),[L]),X=_.useCallback(async(R=u.current,z=!0)=>{let O={...El,...R};u.current=O,h.current=lH(c,O,t);let W;z&&(W=await r(t,O),W&&(x(0),y([[...W]]),A(!0).then(I=>{i(t,O,I)}))),W||(W=await A(!0),i(t,O,W));{const{limit:Z,limitToLast:I,startAfter:ie,startAt:V,endAt:ce,endBefore:Ae,..._e}=O;c.statistics.countOf(N8(t),_e).then(N).catch(console.log)}return W},[t,A,r,i]),H=_.useCallback(async R=>{try{return l(R),await lv(c,t,R),await X(u.current,!1),R}catch(z){throw m(z),w(!1),z}},[t,X]);_.useEffect(()=>{async function R(){var Z;const z=g.flat(1).reduce((I,ie)=>ie.updated_at>I.updated_at?ie:I,(Z=g==null?void 0:g.at(0))==null?void 0:Z.at(0)),O=`storecraft_max_updated_seen_${t}`;let W=await s(O);(z||W)&&(z&&W?(z.updated_at>W.updated_at||z.updated_at==W.updated_at&&z.id>W.id)&&(W=z):W=W??z),W&&o(O,W)}R()},[g,t]);const U=_.useCallback(async()=>{const R=`storecraft_max_updated_seen_${t}`,z=await s(R);return z?await c.statistics.countOf(N8(t),{startAfter:[["updated_at",z.updated_at],["id",z.id]],order:"asc"})>0:!0},[]);_.useEffect(()=>{n&&v==-1&&!d.current&&X(u.current)},[]);const G=v>=0?g[v]:[];return{pages:g,page:G,loading:b,hasLoaded:C,resource_is_probably_empty:oH(u.current,C,b,G.length),error:p,sdk:c,queryCount:k,resource:t,actions:{prev:K,next:$,query:X,poll:U,removeDocument:H}}};function pv(t,e,n=!0,r=!0){const{actions:{get:i,put:s,remove:a}}=WT(),{sdk:o}=rn(),[l,c]=_.useState(!!(t&&e&&n)),[u,d]=_.useState(),[h,p]=_.useState(!1),[m,g]=_.useState(void 0),[y,v]=_.useState(void 0),x=mu();_.useEffect(()=>o.auth.add_sub(x),[x]);const b=_.useRef([t,e]);_.useEffect(()=>{b.current=[t,e]},[t,e]);const w=_.useRef(async(N=!0)=>{const D=b.current[0],A=b.current[1];if(!(D&&A))throw"no doc id";c(!0),g(void 0),v("load");try{let L;return N&&(L=await i(A),L&&Qo(o,D,A).then($=>{s($),d($)})),L||(L=await Qo(o,D,A),s(L)),d(L),p(!0),L}catch(L){throw console.log(L),g(L),L}finally{c(!1)}}),C=_.useCallback(async(N=!0)=>{const D=b.current[0],A=b.current[1];if(!(D&&A))throw console.log("resource",D),console.log("document",A),"no doc id";c(!0),g(void 0),v("load");try{let L;return N&&(L=await i(A),L&&Qo(o,D,A).then($=>{s($),d($)})),L||(L=await Qo(o,D,A),s(L)),d(L),p(!0),L}catch(L){throw console.log(L),g(L),L}finally{c(!1)}},[]),S=_.useCallback(async(N,...D)=>{c(!0),g(void 0),v("update");try{const A=await ET(o,t,N),L=await Qo(o,t,A);return d(L),p(!0),L}catch(A){throw g(A),console.log(JSON.stringify(A,null,2)),A}finally{c(!1)}},[t,e]),k=_.useCallback(async()=>{c(!0),g(void 0),v("delete");try{return await lv(o,t,e),a(e),d(void 0),p(!0),e}catch(N){throw g(N),N}finally{c(!1)}},[t,e]);return _.useEffect(()=>{if(t==null)throw new Error("useDocument: no Collection Id");d(void 0)},[t,e]),_.useEffect(()=>{n&&C(r)},[n,C,t,e]),{doc:u,sdk:o,loading:l,hasLoaded:h,error:m,op:y,resource:t,document:e,actions:{reload:C,reload_hard:w,upsert:S,remove:k,setError:g}}}const mv=()=>{const t=mu(),{sdk:e}=rn();return _.useEffect(()=>{const n=e.auth.add_sub(t);return e.auth.reAuthenticateIfNeeded(),n},[]),{sdk:e,auth:e.auth.currentAuth,isAuthenticated:e.auth.isAuthenticated,actions:{signin:e.auth.signin,signup:e.auth.signup,signout:e.auth.signout,refresh:e.auth.reAuthenticateIfNeeded,changePassword:e.auth.changePassword,apikeys:{list:e.auth.list_api_keys_auth_users,create:e.auth.create_api_key},users:{get:e.auth.get_auth_user,remove:e.auth.remove_auth_user,list:e.auth.list_auth_users}}}},cH=(t,e)=>{const n=t;let r=Em.get(n)??e;const i=new Set,s=o=>(i.add(o),()=>{i.delete(o)}),a=o=>{r=o,Em.set(n,o),i.forEach(l=>l(r))};return()=>{const o=mu();_.useEffect(()=>s(o),[o]);const l=_.useCallback(c=>{typeof c=="function"&&c(r),a(c)},[]);return{state:r,setState:l}}},uH={sortBy:["updated_at","id"],order:"desc",limit:5},dH=()=>{const{sdk:t}=rn();_.useRef(!1);const[e,n]=_.useState(void 0),[r,i]=_.useState(),[s,a]=_.useState(!1),[o,l]=_.useState(!1);mu();const c=_.useCallback(async(u,d=!0)=>{u={...uH,...u};try{const h=await N0(t,"search",u);i(h)}catch(h){n(h)}},[]);return{result:r,loading:s,hasLoaded:o,error:e,sdk:t,actions:{query:c}}},GT=1e3,I0=GT*60,KT=I0*60,gv=KT*24,fH=gv*30,hH=gv*365,A8=[{millis:hH,adj:"year"},{millis:fH,adj:"month"},{millis:gv,adj:"day"},{millis:KT,adj:"hour",singular:"about an hour ago"},{millis:I0,adj:"minute"},{millis:GT,adj:"second"}],pH=t=>{const e=Math.max(Date.now()-new Date(t).getTime(),0);if(e<1e3)return"now";for(let n=0;n<A8.length;n++){const r=A8[n];let i=e/r.millis,s=Math.floor(i);if(s==1)return r.singular??`about a ${r.adj} ago`;if(s>1)return`${s} ${r.adj}s ago`}},qT=(t,e=5e3,n=!0,r=Number.POSITIVE_INFINITY)=>{const i=_.useRef(),s=_.useRef({count:0}),a=_.useCallback(()=>{i.current&&clearTimeout(i.current)},[]),o=_.useCallback(()=>{a(),s.current.count=1,t(1),i.current=setInterval(()=>{s.current.count+=1,t(s.current.count),s.current.count==r&&a()},e)},[a,e]);return _.useEffect(()=>(a(),n&&o(),a),[o,a]),{start:o,stop:a}};new Date().toISOString();new Date().toISOString();const mH=({notification:t})=>{const e=da(),n=_.useCallback(()=>{var s;const r=(s=t==null?void 0:t.actions)==null?void 0:s.at(0),i=r==null?void 0:r.params;if(r)switch(r.type){case"route":let a=i;e(`/pages/${a.collection}/${a.document}`);break;case"url":let o=i;window.open(o.url,o.new_window?"_blank":"_self")}},[t,e,window]);return f.jsx("div",{className:`flex flex-row justify-between items-center w-full
205
+ line items and shipping method`),MB=AB.extend(Hi.shape).extend({status:wB.describe("Status of `checkout`, `fulfillment` and `payment`"),pricing:OB.describe("Pricing information"),validation:E.array(uB).optional().describe("In case the order went through validation"),payment_gateway:EB.optional().describe("Payment gateway info and status")});MB.omit({id:!0}).and(ui).describe("Order upsert type");const Zc={Auto:{id:0,name:"Automatic",name2:"automatic"},Manual:{id:1,name:"Manual",name2:"manual"}},Qt={any:{id:void 0,name:void 0,op:void 0,type:void 0},p_in_collections:{id:0,type:"product",op:"p-in-collections",name:"Product In Collection"},p_not_in_collections:{id:1,type:"product",op:"p-not-in-collections",name:"Product not in Collection"},p_in_products:{id:2,type:"product",op:"p-in-products",name:"Product belongs to"},p_not_in_products:{id:3,type:"product",op:"p-not-in-products",name:"Product does not belong to"},p_in_tags:{id:4,type:"product",op:"p-in-tags",name:"Product has Tag"},p_not_in_tags:{id:5,type:"product",op:"p-not-in-tags",name:"Product excludes Tag"},p_all:{id:6,type:"product",op:"p-all",name:"All Products"},p_in_price_range:{id:7,type:"product",op:"p-in-price-range",name:"Product in Price range"},o_subtotal_in_range:{id:100,type:"order",op:"o-subtotal-in-range",name:"Order subtotal in range"},o_items_count_in_range:{id:101,type:"order",op:"o-items-count-in-range",name:"Order items count in range"},o_date_in_range:{id:102,type:"order",op:"o-date-in-range",name:"Order in dates"},o_has_customer:{id:103,type:"order",op:"o-has-customer",name:"Order has Customers"}},Er={any:{id:void 0,type:void 0,name:void 0},regular:{id:0,type:"regular",name:"Regular Discount"},bulk:{id:1,type:"bulk",name:"Bulk Discount"},buy_x_get_y:{id:2,type:"buy_x_get_y",name:"Buy X Get Y"},order:{id:3,type:"order",name:"Order Discount"},bundle:{id:4,type:"bundle",name:"Bundle Discount"}},T8={created:{id:0,name2:"created",name:"Created"},requires_action:{id:1,name2:"requires_action",name:"Requires Action"},failed:{id:2,name2:"failed",name:"Failed"},complete:{id:3,name2:"complete",name:"Complete"},unknown:{id:4,name2:"unknown",name:"Unknown"}},P4={draft:{id:0,name2:"draft",name:"Draft"},processing:{id:1,name2:"processing",name:"Processing (Stock Reserved)"},shipped:{id:2,name2:"shipped",name:"Shipped"},fulfilled:{id:3,name2:"fulfilled",name:"Fulfilled"},cancelled:{id:4,name2:"cancelled",name:"Cancelled (Stock returned)"}},R4={unpaid:{id:0,name:"Unpaid",name2:"unpaid"},authorized:{id:1,name:"Authorized",name2:"authorized"},captured:{id:2,name:"Captured",name2:"captured"},requires_auth:{id:3,name:"Requires Authentication",name2:"requires_auth"},voided:{id:4,name:"Voided",name2:"voided"},failed:{id:5,name:"Failed",name2:"failed"},partially_paid:{id:6,name:"Partially paid",name2:"partially_paid"},refunded:{id:7,name:"Refunded",name2:"refunded"},partially_refunded:{id:8,name:"Partially Refunded",name2:"partially_refunded"},cancelled:{id:9,name:"Cancelled",name2:"cancelled"}};var Rc,zn,Ba;class IB{constructor(e){$r(this,Rc,new Set);$r(this,zn);ee(this,"notify_subscribers",()=>{for(let e of ct(this,Rc))e({auth:this.currentAuth,isAuthenticated:this.isAuthenticated})});ee(this,"add_sub",e=>(ct(this,Rc).add(e),()=>{ct(this,Rc).delete(e)}));$r(this,Ba,e=>{this.currentAuth=e,this.notify_subscribers()});ee(this,"signin",async(e,n)=>{const r={email:e,password:n},i=await fetch(p1(ct(this,zn).config,"/auth/signin"),{method:"post",body:JSON.stringify(r),headers:{"Content-Type":"application/json"}});if(!i.ok){let a={messages:[{message:"auth/error"}]};try{a=await i.json()}catch{}throw a}const s=await i.json();return ct(this,Ba).call(this,s),s});ee(this,"signup",async(e,n,r,i)=>{const s={email:e,password:n,firstname:r,lastname:i},a=await fetch(p1(ct(this,zn).config,"/auth/signup"),{method:"post",body:JSON.stringify(s),headers:{"Content-Type":"application/json"}});Dj(a.ok,"auth/error");const o=await a.json();return ct(this,Ba).call(this,o),o});ee(this,"changePassword",async e=>{const n=await fetch(p1(ct(this,zn).config,"/auth/change-password"),{method:"post",body:JSON.stringify(e),headers:{"Content-Type":"application/json"}});if(!n.ok){let i={messages:[{message:"auth/error"}]};try{i=await n.json()}catch{}throw i}const r=await n.json();return ct(this,Ba).call(this,r),r});ee(this,"signout",async()=>{console.log("signout"),ct(this,Ba).call(this,void 0)});ee(this,"create_api_key",async()=>(await tn(ct(this,zn),"/auth/apikeys",{method:"post"})).apikey);ee(this,"get_auth_user",async e=>await tn(ct(this,zn),`/auth/users/${e}`,{method:"get"}));ee(this,"remove_auth_user",async e=>tn(ct(this,zn),`/auth/users/${e}`,{method:"delete"}));ee(this,"list_auth_users",async e=>{const n=cs(e);return tn(ct(this,zn),`/auth/users?${n.toString()}`,{method:"get"})});ee(this,"list_api_keys_auth_users",async()=>await tn(ct(this,zn),"/auth/apikeys",{method:"get"}));_a(this,zn,e)}get currentAuth(){var e,n;return(n=(e=ct(this,zn))==null?void 0:e.config)==null?void 0:n.auth}set currentAuth(e){ct(this,zn).config.auth=e}init(){}async working_auth_token(e=!1){if(this.currentAuth){if("apikey"in this.currentAuth)return this.currentAuth.apikey;if("access_token"in this.currentAuth)return(e||!this.isAuthenticated)&&await this.reAuthenticateIfNeeded(e),this.currentAuth.access_token.token}}async reAuthenticateIfNeeded(e=!1){if(this.currentAuth&&!(this.isAuthenticated&&!e)&&"access_token"in this.currentAuth){const n=await fetch(p1(ct(this,zn).config,"/auth/refresh"),{method:"post",body:JSON.stringify({refresh_token:this.currentAuth.refresh_token.token}),headers:{"Content-Type":"application/json"}});let r;return n.ok&&(r=await n.json()),ct(this,Ba).call(this,r),r}}get authStrategy(){if(this.currentAuth){if("apikey"in this.currentAuth)return"apikey";if("access_token"in this.currentAuth)return"jwt"}return"unknown"}get isAuthenticated(){var e,n,r;if(this.currentAuth){if("apikey"in this.currentAuth)return!!this.currentAuth.apikey;if("access_token"in this.currentAuth){const i=(r=(n=(e=this.currentAuth)==null?void 0:e.access_token)==null?void 0:n.claims)==null?void 0:r.exp;return i&&Date.now()<(i-60)*1e3}}return!1}}Rc=new WeakMap,zn=new WeakMap,Ba=new WeakMap;let LB=class extends Rr{constructor(e){super(e,"customers")}},PB=class extends Rr{constructor(e){super(e,"tags")}},RB=class extends Rr{constructor(e){super(e,"templates")}},jB=class extends Rr{constructor(n){super(n,"products");ee(this,"changeStockOfBy",async(n,r)=>(await Ia(this.sdk,`products/${n}?quantityBy=${r}`,{method:"put"})).ok);ee(this,"batchAddProductsToCollection",async(n,r)=>{for(const i of n)await this.upsert({...i,collections:[...i.collections??[],r]})});ee(this,"batchRemoveProductsFromCollection",async(n,r)=>{for(const i of n)await this.upsert({...i,collections:(i.collections??[]).filter(s=>s.id!==r.id)})})}},FB=class extends Rr{constructor(e){super(e,"orders")}},BB=class extends Rr{constructor(e){super(e,"discounts")}},HB=class extends Rr{constructor(n){super(n,"collections");ee(this,"publish",async(n,r=1e3)=>await tn(this.sdk,`collections/${n}/export`,{method:"post"}))}};class zB extends Rr{constructor(e){super(e,"shipping")}}let UB=class extends Rr{constructor(n){super(n,"storefronts");ee(this,"publish",async n=>await tn(this.sdk,`storefronts/${n}/export`,{method:"post"}))}};var tf,nf;class $B{constructor(e){$r(this,tf);$r(this,nf,{});ee(this,"isCacheValid",e=>!1);ee(this,"fromCache",e=>{if(this.isCacheValid(e))return ct(this,nf)[e]});ee(this,"putCache",(e,n)=>{ct(this,nf)[e]=n});ee(this,"orders",async(e,n)=>{const r=new URLSearchParams;return e&&r.set("fromDay",new Date(e).toISOString()),n&&r.set("toDay",new Date(n).toISOString()),tn(this.sdk,`statistics/orders?${r.toString()}`)});ee(this,"countOf",async(e,n)=>{const r=cs(n);return tn(this.sdk,`statistics/count/${e}?${r.toString()}`)});_a(this,tf,e)}get sdk(){return ct(this,tf)}}tf=new WeakMap,nf=new WeakMap;let VB=class extends Rr{constructor(e){super(e,"images")}},YB=class extends Rr{constructor(e){super(e,"posts")}};class WB{constructor(e){ee(this,"create",async(e,n)=>(console.log("input",e),await tn(this.sdk,`checkout/create?gateway=${n}`,{method:"post",body:JSON.stringify(e),headers:{"Content-Type":"application/json"}})));ee(this,"complete",async e=>await tn(this.sdk,`checkout/${e}/complete`,{method:"post"}));ee(this,"pricing",async e=>await tn(this.sdk,"checkout/pricing",{method:"post",body:JSON.stringify(e),headers:{"Content-Type":"application/json"}}));this.sdk=e}}var rf;class GB{constructor(e){$r(this,rf);_a(this,rf,e)}get(e){return Qo(this.sdk,"payments/gateways",e)}list(){return N0(this.sdk,"payments/gateways")}paymentStatusOfOrder(e){return tn(this.sdk,`/payments/status/${e}`,{method:"get"})}invokeAction(e,n){return tn(this.sdk,`/payments/${e}/${n}`,{method:"post"})}get sdk(){return ct(this,rf)}}rf=new WeakMap;let KB=class extends Rr{constructor(e){super(e,"settings")}},qB=class extends Rr{constructor(n){super(n,"notifications");ee(this,"upsertBulk",n=>tn(this.sdk,`${this.base_name}`,{method:"post",body:JSON.stringify(n),headers:{"Content-Type":"application/json"}}));ee(this,"meta",()=>this.get("_meta"))}};var jc;class QB{constructor(e){$r(this,jc,{features:void 0});ee(this,"features",async()=>{if(ct(this,jc).features)return ct(this,jc).features;try{const e=await Ia(this.sdk,"storage",{method:"get"});if(!e.ok)throw new Error;const n=await e.json();return ct(this,jc).features=n,n}catch(e){console.log(e)}return{supports_signed_urls:!1}});ee(this,"getBlobSigned",async e=>{const n=await Ia(this.sdk,`storage/${e}?signed=true`,{method:"get"}),r=n.headers.get("Content-Type");if(!n.ok)throw await n.json();if(r==="application/json"){const i=await n.json();return(await fetch(i.url,{method:i.method,headers:i.headers})).blob()}throw"unknown"});ee(this,"getBlobUnsigned",async e=>{const n=await Ia(this.sdk,`storage/${e}?signed=false`,{method:"get"});if(n.headers.get("Content-Type"),!n.ok)throw await n.json();return n.blob()});ee(this,"getBlob",async e=>(await this.features()).supports_signed_urls?this.getBlobSigned(e):this.getBlobUnsigned(e));ee(this,"getText",e=>this.getBlob(e).then(n=>n.text()));ee(this,"getJson",e=>this.getBlob(e).then(n=>n.text().then(JSON.parse)));ee(this,"getImageObjectURL",e=>this.getBlob(e).then(n=>URL.createObjectURL(n)));ee(this,"getSource",async(e,n=!0)=>{try{if(!e.startsWith("storage://"))return e;const i=e.split("storage://").at(-1),s=await this.getBlob(i);return n?URL.createObjectURL(s):s.text().then(JSON.parse)}catch(r){console.log(r)}return e});ee(this,"putBytesSigned",async(e,n)=>{const r=await Ia(this.sdk,`storage/${e}?signed=true`,{method:"put"}),i=r.headers.get("Content-Type");if(!r.ok)throw await r.json();if(i==="application/json"){const s=await r.json();return(await fetch(s.url,{method:s.method,headers:s.headers,body:n})).ok}throw"unknown"});ee(this,"putBytesUnsigned",async(e,n)=>{const r=await Ia(this.sdk,`storage/${e}?signed=false`,{method:"put",body:n});if(r.headers.get("Content-Type"),!r.ok)throw await r.json();return r.ok});ee(this,"putBytes",async(e,n)=>(await this.features()).supports_signed_urls?this.putBytesSigned(e,n):this.putBytesUnsigned(e,n));ee(this,"delete",async e=>(await Ia(this.sdk,`storage/${e}`,{method:"delete"})).ok);this.sdk=e}}jc=new WeakMap;var Fc;class ZB{constructor(e){$r(this,Fc);_a(this,Fc,e),this.auth=new IB(this),this.storage=new QB(this),this.customers=new LB(this),this.tags=new PB(this),this.templates=new RB(this),this.products=new jB(this),this.orders=new FB(this),this.collections=new HB(this),this.discounts=new BB(this),this.shipping=new zB(this),this.storefronts=new UB(this),this.statistics=new $B(this),this.images=new VB(this),this.posts=new YB(this),this.payments=new GB(this),this.checkout=new WB(this),this.settings=new KB(this),this.notifications=new qB(this)}updateConfig(e){_a(this,Fc,e)}get config(){return ct(this,Fc)}}Fc=new WeakMap;const XB=()=>typeof window<"u",JB=t=>({get:e=>{if(typeof window>"u")return null;const n=t.getItem(e);return n?JSON.parse(n):null},set:(e,n)=>{if(!(typeof window>"u"))try{typeof window<"u"&&t.setItem(e,JSON.stringify(typeof n>"u"?null:n))}catch(r){console.error(`local_storage_adapter ${e} `,r)}},remove:e=>{typeof window<"u"&&t.removeItem(e)}}),Em=JB(XB()?window.localStorage:void 0),YT="storecraft_latest_config",S8=()=>(rs==null?void 0:rs.config)??Em.get(YT);var rs=new ZB;const eH=(t={})=>{Em.set(YT,t)},tH=t=>{rs.updateConfig(t),eH(t)},rn=(t=S8())=>{const[e,n]=_.useState(void 0),r=mu(),i=rs.auth.isAuthenticated,s=_.useCallback(a=>{tH(a),r()},[r]);return _.useEffect(()=>{s(t)},[t]),_.useEffect(()=>{const a=rs.auth.add_sub(({auth:o})=>{s({...rs.config,auth:o})});return rs.auth.reAuthenticateIfNeeded(),a},[]),{config:rs.config??S8(),sdk:rs,isAuthenticated:i,error:e,actions:{updateConfig:s,trigger:r}}},M0=t=>new Promise((e,n)=>{let r=indexedDB.open(t,1);r.onupgradeneeded=function(i){i.target.result.createObjectStore("main")},r.onsuccess=function(i){e(i.target.result)},r.onerror=function(i){n(i.target.errorCode)}}),nH=(t,e="main")=>(n,r)=>new Promise((i,s)=>{M0(t).then(a=>{let c=a.transaction(e,"readwrite").objectStore(e).put(r,n);c.onsuccess=function(u){const d=u.target.result;n===d?i(n):s()},c.onerror=function(u){s(u.target.errorCode)}}).catch(s)}),rH=(t,e="main")=>n=>new Promise((r,i)=>{M0(t).then(s=>{let l=s.transaction(e,"readwrite").objectStore(e).get(n);l.onsuccess=function(c){const u=c.target.result;u?r(u):i()},l.onerror=function(c){i(c.target.errorCode)}}).catch(i)}),iH=(t,e="main")=>n=>new Promise((r,i)=>{M0(t).then(s=>{let l=s.transaction(e,"readwrite").objectStore(e).delete(n);l.onsuccess=function(c){r(n)},l.onerror=function(c){i(c.target.errorCode)}}).catch(i)}),hv=t=>{const[e,n]=_.useState(),[r,i]=_.useState();_.useEffect(()=>{M0(t).then(n).catch(i)},[t]);const s=_.useCallback(async(l,c)=>{try{return await nH(t,"main")(l,c)}catch(u){i(u)}},[]),a=_.useCallback(async l=>{try{return await rH(t,"main")(l)}catch(c){i(c)}},[]),o=_.useCallback(async l=>{try{return await iH(t,"main")(l)}catch(c){i(c)}},[]);return{db:e,error:r,actions:{get:a,put:s,remove:o}}},WT=()=>{const{db:t,error:e,actions:{get:n,put:r,remove:i}}=hv("storecraft_document_cache"),s=_.useCallback(c=>n(c),[n]),a=_.useCallback(async c=>{try{const u=[];c&&"handle"in c&&u.push(r(String(c.handle),c)),c&&"id"in c&&u.push(r(c.id,c)),await Promise.all(u)}catch{}return c.id},[r]),o=_.useCallback(async(c,u)=>{try{await r(c,u)}catch{}return u.id},[r]),l=_.useCallback(c=>{try{return i(c)}catch{}},[i]);return{db:t,error:e,actions:{get:s,put:a,putWithKey:o,remove:l}}},sH=()=>hv("storecraft_misc_cache"),aH=()=>{const{db:t,error:e,actions:{get:n,put:r,remove:i}}=hv("storecraft_query_cache"),s=_.useCallback((l,c)=>{const u=l+"_"+cs(c).toString();return n(u)},[n]),a=_.useCallback((l,c,u)=>{const d=l+"_"+cs(c).toString();return r(d,u)},[r]),o=_.useCallback((l,c)=>{try{const u=l+"_"+cs(c).toString();return i(u)}catch{}},[i]);return{db:t,error:e,actions:{get:s,put:a,remove:o}}},N8=t=>t==="shipping"?"shipping_methods":t,oH=(t,e,n,r)=>e&&!n&&r!==void 0&&r<=0&&t&&!t.vql&&!t.endAt&&!t.endBefore&&!t.startAt&&!t.startAfter,lH=(t,e,n)=>{e.sortBy=e.sortBy??["updated_at","id"];let r=e.startAfter;return async()=>{const s={...e,startAfter:r},a=await N0(t,n,s);return a!=null&&a.length&&(r=s.sortBy.map((o,l)=>{var c;return[o,(c=a.at(-1))==null?void 0:c[o]]})),a}},El={sortBy:["updated_at","id"],order:"desc",limit:5},Co=(t,e=El,n=!0)=>{const{actions:{get:r,put:i}}=aH(),{actions:{get:s,put:a,putWithKey:o,remove:l}}=WT(),{sdk:c}=rn(),u=_.useRef(e),d=_.useRef(!1),h=_.useRef(),[p,m]=_.useState(void 0),[g,y]=_.useState([]),[v,x]=_.useState(-1),[b,w]=_.useState(n),[C,S]=_.useState(!1),[k,N]=_.useState(-1),D=mu();_.useEffect(()=>c.auth.add_sub(D),[D]);const A=_.useCallback(async(R=!1)=>{let z;w(!0);try{z=await h.current();for(let O of z)a(O);R?(x(0),y([[...z]])):(x(O=>O+1),y(O=>[...O,[...z]])),S(!0)}catch(O){m(O==null?void 0:O.code)}finally{w(!1)}return z},[]),L=_.useCallback(R=>{if(!h.current)return Promise.resolve();const z=R?1:-1;return v+z<0?Promise.resolve():v+z<g.length?(x(v+z),Promise.resolve()):A()},[g,v,A]),$=_.useCallback(()=>L(!0),[L]),K=_.useCallback(()=>L(!1),[L]),X=_.useCallback(async(R=u.current,z=!0)=>{let O={...El,...R};u.current=O,h.current=lH(c,O,t);let W;z&&(W=await r(t,O),W&&(x(0),y([[...W]]),A(!0).then(I=>{i(t,O,I)}))),W||(W=await A(!0),i(t,O,W));{const{limit:Z,limitToLast:I,startAfter:ie,startAt:V,endAt:ce,endBefore:Ae,..._e}=O;c.statistics.countOf(N8(t),_e).then(N).catch(console.log)}return W},[t,A,r,i]),H=_.useCallback(async R=>{try{return l(R),await lv(c,t,R),await X(u.current,!1),R}catch(z){throw m(z),w(!1),z}},[t,X]);_.useEffect(()=>{async function R(){var Z;const z=g.flat(1).reduce((I,ie)=>ie.updated_at>I.updated_at?ie:I,(Z=g==null?void 0:g.at(0))==null?void 0:Z.at(0)),O=`storecraft_max_updated_seen_${t}`;let W=await s(O);(z||W)&&(z&&W?(z.updated_at>W.updated_at||z.updated_at==W.updated_at&&z.id>W.id)&&(W=z):W=W??z),W&&o(O,W)}R()},[g,t]);const U=_.useCallback(async()=>{const R=`storecraft_max_updated_seen_${t}`,z=await s(R);return z?await c.statistics.countOf(N8(t),{startAfter:[["updated_at",z.updated_at],["id",z.id]],order:"asc"})>0:!0},[]);_.useEffect(()=>{n&&v==-1&&!d.current&&X(u.current)},[]);const G=v>=0?g[v]:[];return{pages:g,page:G,loading:b,hasLoaded:C,resource_is_probably_empty:oH(u.current,C,b,G.length),error:p,sdk:c,queryCount:k,resource:t,actions:{prev:K,next:$,query:X,poll:U,removeDocument:H}}};function pv(t,e,n=!0,r=!0){const{actions:{get:i,put:s,remove:a}}=WT(),{sdk:o}=rn(),[l,c]=_.useState(!!(t&&e&&n)),[u,d]=_.useState(),[h,p]=_.useState(!1),[m,g]=_.useState(void 0),[y,v]=_.useState(void 0),x=mu();_.useEffect(()=>o.auth.add_sub(x),[x]);const b=_.useRef([t,e]);_.useEffect(()=>{b.current=[t,e]},[t,e]);const w=_.useRef(async(N=!0)=>{const D=b.current[0],A=b.current[1];if(!(D&&A))throw"no doc id";c(!0),g(void 0),v("load");try{let L;return N&&(L=await i(A),L&&Qo(o,D,A).then($=>{s($),d($)})),L||(L=await Qo(o,D,A),s(L)),d(L),p(!0),L}catch(L){throw console.log(L),g(L),L}finally{c(!1)}}),C=_.useCallback(async(N=!0)=>{const D=b.current[0],A=b.current[1];if(!(D&&A))throw console.log("resource",D),console.log("document",A),"no doc id";c(!0),g(void 0),v("load");try{let L;return N&&(L=await i(A),L&&Qo(o,D,A).then($=>{s($),d($)})),L||(L=await Qo(o,D,A),s(L)),d(L),p(!0),L}catch(L){throw console.log(L),g(L),L}finally{c(!1)}},[]),S=_.useCallback(async(N,...D)=>{c(!0),g(void 0),v("update");try{const A=await ET(o,t,N),L=await Qo(o,t,A);return d(L),p(!0),L}catch(A){throw g(A),console.log(JSON.stringify(A,null,2)),A}finally{c(!1)}},[t,e]),k=_.useCallback(async()=>{c(!0),g(void 0),v("delete");try{return await lv(o,t,e),a(e),d(void 0),p(!0),e}catch(N){throw g(N),N}finally{c(!1)}},[t,e]);return _.useEffect(()=>{if(t==null)throw new Error("useDocument: no Collection Id");d(void 0)},[t,e]),_.useEffect(()=>{n&&C(r)},[n,C,t,e]),{doc:u,sdk:o,loading:l,hasLoaded:h,error:m,op:y,resource:t,document:e,actions:{reload:C,reload_hard:w,upsert:S,remove:k,setError:g}}}const mv=()=>{const t=mu(),{sdk:e}=rn();return _.useEffect(()=>{const n=e.auth.add_sub(t);return e.auth.reAuthenticateIfNeeded(),n},[]),{sdk:e,auth:e.auth.currentAuth,isAuthenticated:e.auth.isAuthenticated,actions:{signin:e.auth.signin,signup:e.auth.signup,signout:e.auth.signout,refresh:e.auth.reAuthenticateIfNeeded,changePassword:e.auth.changePassword,apikeys:{list:e.auth.list_api_keys_auth_users,create:e.auth.create_api_key},users:{get:e.auth.get_auth_user,remove:e.auth.remove_auth_user,list:e.auth.list_auth_users}}}},cH=(t,e)=>{const n=t;let r=Em.get(n)??e;const i=new Set,s=o=>(i.add(o),()=>{i.delete(o)}),a=o=>{r=o,Em.set(n,o),i.forEach(l=>l(r))};return()=>{const o=mu();_.useEffect(()=>s(o),[o]);const l=_.useCallback(c=>{typeof c=="function"&&c(r),a(c)},[]);return{state:r,setState:l}}},uH={sortBy:["updated_at","id"],order:"desc",limit:5},dH=()=>{const{sdk:t}=rn();_.useRef(!1);const[e,n]=_.useState(void 0),[r,i]=_.useState(),[s,a]=_.useState(!1),[o,l]=_.useState(!1);mu();const c=_.useCallback(async(u,d=!0)=>{u={...uH,...u};try{const h=await N0(t,"search",u);i(h)}catch(h){n(h)}},[]);return{result:r,loading:s,hasLoaded:o,error:e,sdk:t,actions:{query:c}}},GT=1e3,I0=GT*60,KT=I0*60,gv=KT*24,fH=gv*30,hH=gv*365,A8=[{millis:hH,adj:"year"},{millis:fH,adj:"month"},{millis:gv,adj:"day"},{millis:KT,adj:"hour",singular:"about an hour ago"},{millis:I0,adj:"minute"},{millis:GT,adj:"second"}],pH=t=>{const e=Math.max(Date.now()-new Date(t).getTime(),0);if(e<1e3)return"now";for(let n=0;n<A8.length;n++){const r=A8[n];let i=e/r.millis,s=Math.floor(i);if(s==1)return r.singular??`about a ${r.adj} ago`;if(s>1)return`${s} ${r.adj}s ago`}},qT=(t,e=5e3,n=!0,r=Number.POSITIVE_INFINITY)=>{const i=_.useRef(),s=_.useRef({count:0}),a=_.useCallback(()=>{i.current&&clearTimeout(i.current)},[]),o=_.useCallback(()=>{a(),s.current.count=1,t(1),i.current=setInterval(()=>{s.current.count+=1,t(s.current.count),s.current.count==r&&a()},e)},[a,e]);return _.useEffect(()=>(a(),n&&o(),a),[o,a]),{start:o,stop:a}};new Date().toISOString();new Date().toISOString();const mH=({notification:t})=>{const e=da(),n=_.useCallback(()=>{var s;const r=(s=t==null?void 0:t.actions)==null?void 0:s.at(0),i=r==null?void 0:r.params;if(r)switch(r.type){case"route":let a=i;e(`/pages/${a.collection}/${a.document}`);break;case"url":let o=i;window.open(o.url,o.new_window?"_blank":"_self")}},[t,e,window]);return f.jsx("div",{className:`flex flex-row justify-between items-center w-full
207
206
  cursor-pointer`,onClick:n,children:f.jsxs("div",{className:"w-full",children:[f.jsx(Xt,{className:"text-base",value:t.message}),f.jsxs("div",{className:`flex flex-row items-center w-full
208
207
  justify-between mt-1`,children:[f.jsx("p",{children:pH(t.updated_at??Date.now()),className:`text-pink-500 --text-gray-400
209
208
  font-semibold text-xs w-fit`}),f.jsxs("div",{className:`flex flex-row items-baseline
@@ -662,7 +661,7 @@ Valid keys: `+JSON.stringify(Object.keys(R),null," "));var ye=Ne(V,_e,Z,I,ie+".
662
661
  transition-transform cursor-pointer`,stroke:"border-2",rounded:"rounded-full",from:"from-pink-500",to:"to-kf-500",onClick:()=>!r&&c.current.show(),children:f.jsx(wH,{className:"text-4xl text-white "+(r?"animate-spin":"")})})]})}),f.jsx(ha,{ref:c,children:f.jsx(_f,{onSave:d,onCancel:()=>c.current.hide()})})]}),f.jsx(de,{show:!(t!=null&&t.handle),children:f.jsx("p",{children:`Only after Collection is created,
663
662
  you will be able to add products here`,className:"text-2xl font-semibold text-gray-400"})})]})},zce=({collectionId:t,value:e})=>{const[n,r]=_.useState([]),[i,s]=_.useState(),{sdk:a}=rn();t=(e==null?void 0:e.handle)??t;const o=_.useCallback(async(l=!0)=>{try{s(void 0),await a.collections.bulkAddRemoveTags(t,n,l)}catch(c){console.error(c),s((c==null?void 0:c.message)??String(c))}},[n,t]);return t?f.jsxs(fa,{name:"Add tags to all products in Collection",className:"w-full h-fit",error:i,desc:"Add/Remove all tags at once",children:[f.jsx(pa,{className:"w-full h-fit",onChange:r}),f.jsx(Ct,{className:"my-5"}),f.jsxs("div",{className:"flex flex-row justify-between w-full --mt-5",children:[f.jsx(Zr,{text:"Add Tags",keep_text_on_load:!0,className:"w-fit",onClick:l=>o(!0)}),f.jsx(Zr,{text:"Remove Tags",keep_text_on_load:!0,className:"w-fit",onClick:l=>o(!1)})]})]}):null},Uce={name:"Root",comp:He,comp_params:{className:"w-full flex flex-col gap-5 max-w- lg:w-[35rem]"},fields:[{comp:Hce,comp_params:{className:"w-full"}},{key:"title",name:"Title",type:"text",validate:!0,editable:!0,desc:"Give an efficient title to the collection, e.g. - Women shirts",comp:Q(Ie(Pe),{className:"w-full h-10"}),comp_params:{className:"w-full h-fit"}},{key:"handle",name:"🔗 Handle",type:"text",validate:!1,editable:!0,desc:`A handle uniquely identifies the collection.
664
663
  Will be computed automatically if not filled by the product title`,comp:Q(j0,{className:"w-full h-fit"}),comp_params:{className:"w-full h-fit"}},{key:"desc",name:"📝 Description",type:"text",validate:!1,editable:!0,desc:"Describe the collection for your customers",comp:Q(ya),comp_params:{className:"w-full"}},{key:"media",name:"🎥 Media",validate:!1,editable:!0,desc:"Manage and edit your media files",comp:Q(Nu),comp_params:{className:"w-full"}},{key:"attributes",name:"Attributes",validate:!1,editable:!0,desc:"Attributes can contain richer text values than tags",comp:Q(So),comp_params:{className:"w-full"}},{name:"JSON",type:"compund",validate:!1,editable:!1,desc:"Observe the RAW data",comp:Ds,comp_params:{className:"w-full"}}]},$ce={name:"Main",comp:He,comp_params:{className:`w-full items-center lg:items-start lg:w-[18rem]
665
- flex flex-col gap-5`},fields:[{key:"active",name:"Active",validate:!0,desc:"activate or deactivate the collection",editable:!0,defaultValue:!0,comp:Q(vf,{className:"text-gray-600"},!0),comp_params:{className:"w-full"}},{key:"tags",name:"# Tags",type:"compund",validate:!1,editable:!0,desc:"Use tags to attach attributes to the collection",comp:Q(pa),comp_params:{className:"w-full "}},{comp:zce,comp_params:{className:"w-full"}}]},Vce={name:"Root",comp:He,comp_params:{className:"w-full gap-5 --justify-center --bg-red-100 items-center lg:max-w-max lg:items-start lg:w-fit flex flex-col lg:flex-row --mx-auto"},fields:[Uce,$ce]},Yce=({onClickSave:t=void 0,onClickCreate:e=void 0,onClickDelete:n=void 0,onClickPublish:r=void 0,onClickDuplicate:i=void 0,onClickReload:s,id:a,className:o})=>f.jsx(Ns,{id:a,className:o,onClickCreate:e,onClickDelete:n,onClickDuplicate:i,onClickReload:s,onClickSave:t,children:f.jsx(Zr,{Icon:f.jsx(tv,{}),text:"publish",keep_text_on_load:!0,show:!!r,onClick:r,className:""})}),i5=({mode:t,...e})=>{const{id:n,base:r}=fr(),{actions:{savePromise:i,deletePromise:s,setError:a,reload:o,navWithState:l,duplicate:c},context:u,key:d,sdk:h,doc:p,isCreateMode:m,isEditMode:g,isViewMode:y,loading:v,hasChanged:x,hasLoaded:b,error:w,ref_head:C,ref_root:S}=mi("collections",n,"/pages/collections",t,r),k=_.useCallback(()=>c({title:(p==null?void 0:p.title)+" duplicate"}),[p,c]),N=_.useCallback(async()=>{await i(),a(void 0);try{await h.collections.publish(n,400),await o()}catch(D){a({messages:[{message:D.toString()}]})}},[n,i,o]);return f.jsxs("div",{className:"w-full lg:min-w-fit mx-auto",children:[f.jsx($i,{major:["collections",n??"create"],className:""}),f.jsx(As,{doc:p,className:"mt-5",collectionId:"collections"}),f.jsx(Yce,{onClickSave:g?i:void 0,onClickCreate:m?i:void 0,onClickPublish:m?void 0:N,onClickDelete:m?void 0:s,onClickDuplicate:m?void 0:k,onClickReload:m?void 0:async()=>o(!1),id:n,className:"mt-5"}),f.jsx(Cs,{changes_made:x,ref:C,time:p==null?void 0:p.created_at,className:"mt-8"},p==null?void 0:p.updated_at),f.jsx(de,{show:b&&g||m,children:f.jsxs("div",{className:"w-full max-w-[40rem] lg:w-fit lg:max-w-none mx-auto",children:[f.jsx(Hr,{error:w,className:"w-full"}),f.jsx(ci,{ref:S,field:Vce,context:u,value:p??{},isViewMode:y,className:"mt-8"},d)]})})]})},Ip=t=>{switch(t){case Er.regular.type:return"bg-teal-600 dark:bg-teal-600/40";case Er.bulk.type:return"bg-red-400 dark:bg-red-400/40";case Er.buy_x_get_y.type:return"bg-cyan-500 dark:bg-cyan-500/40";case Er.order.type:return"bg-kf-400 dark:bg-kf-400/40";case Er.bundle.type:return"bg-sky-500 dark:bg-sky-400/40";default:return"bg-slate-400 dark:bg-slate-400/20"}},Wce=({value:t,...e})=>{const n=_.useMemo(()=>{var i;return(i=Object.values(Er).find(s=>s.type===(t==null?void 0:t.type)))==null?void 0:i.name.split(" ")[0]},[t]),r="text-white rounded-xl py-px px-2 whitespace-nowrap border shelf-border-color-blend "+Ip(t==null?void 0:t.type);return f.jsx("span",{className:r+" bg-",children:n})},Gce=({...t})=>f.jsxs("div",{...t,children:[f.jsxs("div",{className:"flex flex-row gap-2 flex-wrap",children:[f.jsx(on,{to:"/pages/discounts",draggable:"false",children:f.jsx(Ka,{value:"all",bgColor:"bg-pink-400 dark:bg-pink-400/60"})}),Object.values(Er).map(e=>f.jsx(on,{draggable:"false",to:`/pages/discounts/q/vql=type:${e.id}`,children:f.jsx(Ka,{value:e.name,bgColor:Ip(e.type)})},e.id))]}),f.jsxs("div",{className:"flex flex-row flex-wrap gap-2 mt-1",children:[Object.values(Zc).map(e=>f.jsx(on,{draggable:"false",to:`/pages/discounts/q/vql=app:${e.name.toLowerCase()}`,children:f.jsx(Ka,{value:e.name,bgColor:Ip(e.type)})},e.id)),[{name:"enabled",v:!0},{name:"disabled",v:!1}].map((e,n)=>f.jsx(on,{draggable:"false",to:`/pages/discounts/q/vql=active:${e.v}`,children:f.jsx(Ka,{value:e.name,bgColor:Ip(void 0)})},n))]})]}),Kce=({value:t,context:e,...n})=>{const r=e.item.active?"bg-teal-500":"bg-red-500",i="whitespace-nowrap pr-2 font-semibold text-base max-w-[150px] sm:max-w-max overflow-clip hover:overflow-x-auto",s=e.item.application.id===Zc.Manual.id;return f.jsxs("div",{className:i,children:[f.jsx("span",{children:t}),s&&f.jsx(zR,{className:`block --text-xl text-white --p-0.5
664
+ flex flex-col gap-5`},fields:[{key:"active",name:"Active",validate:!0,desc:"activate or deactivate the collection",editable:!0,defaultValue:!0,comp:Q(vf,{className:"text-gray-600"},!0),comp_params:{className:"w-full"}},{key:"tags",name:"# Tags",type:"compund",validate:!1,editable:!0,desc:"Use tags to attach attributes to the collection",comp:Q(pa),comp_params:{className:"w-full "}},{comp:zce,comp_params:{className:"w-full"}}]},Vce={name:"Root",comp:He,comp_params:{className:"w-full gap-5 --justify-center --bg-red-100 items-center lg:max-w-max lg:items-start lg:w-fit flex flex-col lg:flex-row --mx-auto"},fields:[Uce,$ce]},Yce=({onClickSave:t=void 0,onClickCreate:e=void 0,onClickDelete:n=void 0,onClickPublish:r=void 0,onClickDuplicate:i=void 0,onClickReload:s,id:a,className:o})=>f.jsx(Ns,{id:a,className:o,onClickCreate:e,onClickDelete:n,onClickDuplicate:i,onClickReload:s,onClickSave:t,children:f.jsx(Zr,{Icon:f.jsx(tv,{}),text:"publish",keep_text_on_load:!0,show:!!r,onClick:r,className:""})}),i5=({mode:t,...e})=>{const{id:n,base:r}=fr(),{actions:{savePromise:i,deletePromise:s,setError:a,reload:o,navWithState:l,duplicate:c},context:u,key:d,sdk:h,doc:p,isCreateMode:m,isEditMode:g,isViewMode:y,loading:v,hasChanged:x,hasLoaded:b,error:w,ref_head:C,ref_root:S}=mi("collections",n,"/pages/collections",t,r),k=_.useCallback(()=>c({title:(p==null?void 0:p.title)+" duplicate"}),[p,c]),N=_.useCallback(async()=>{await i(),a(void 0);try{await h.collections.publish(n,400),await o()}catch(D){a({messages:[{message:D.toString()}]})}},[n,i,o]);return f.jsxs("div",{className:"w-full lg:min-w-fit mx-auto",children:[f.jsx($i,{major:["collections",n??"create"],className:""}),f.jsx(As,{doc:p,className:"mt-5",collectionId:"collections"}),f.jsx(Yce,{onClickSave:g?i:void 0,onClickCreate:m?i:void 0,onClickPublish:m?void 0:N,onClickDelete:m?void 0:s,onClickDuplicate:m?void 0:k,onClickReload:m?void 0:async()=>o(!1),id:n,className:"mt-5"}),f.jsx(Cs,{changes_made:x,ref:C,time:p==null?void 0:p.created_at,className:"mt-8"},p==null?void 0:p.updated_at),f.jsx(de,{show:b&&g||m,children:f.jsxs("div",{className:"w-full max-w-[40rem] lg:w-fit lg:max-w-none mx-auto",children:[f.jsx(Hr,{error:w,className:"w-full"}),f.jsx(ci,{ref:S,field:Vce,context:u,value:p??{},isViewMode:y,className:"mt-8"},d)]})})]})},Ip=t=>{switch(t){case Er.regular.type:return"bg-teal-600 dark:bg-teal-600/40";case Er.bulk.type:return"bg-red-400 dark:bg-red-400/40";case Er.buy_x_get_y.type:return"bg-cyan-500 dark:bg-cyan-500/40";case Er.order.type:return"bg-kf-400 dark:bg-kf-400/40";case Er.bundle.type:return"bg-sky-500 dark:bg-sky-400/40";default:return"bg-slate-400 dark:bg-slate-400/20"}},Wce=({value:t,...e})=>{const n=_.useMemo(()=>{var i;return(i=Object.values(Er).find(s=>s.type===(t==null?void 0:t.type)))==null?void 0:i.name.split(" ")[0]},[t]),r="text-white rounded-xl py-px px-2 whitespace-nowrap border shelf-border-color-blend "+Ip(t==null?void 0:t.type);return f.jsx("span",{className:r+" bg-",children:n})},Gce=({...t})=>f.jsxs("div",{...t,children:[f.jsxs("div",{className:"flex flex-row gap-2 flex-wrap",children:[f.jsx(on,{to:"/pages/discounts",draggable:"false",children:f.jsx(Ka,{value:"all",bgColor:"bg-pink-400 dark:bg-pink-400/60"})}),Object.values(Er).filter(e=>!!e.type).map(e=>f.jsx(on,{draggable:"false",to:`/pages/discounts/q/vql=type:${e.id}`,children:f.jsx(Ka,{value:e.name,bgColor:Ip(e.type)})},e.id))]}),f.jsxs("div",{className:"flex flex-row flex-wrap gap-2 mt-1",children:[Object.values(Zc).map(e=>f.jsx(on,{draggable:"false",to:`/pages/discounts/q/vql=app:${e.name.toLowerCase()}`,children:f.jsx(Ka,{value:e.name,bgColor:Ip("")})},e.id)),[{name:"enabled",v:!0},{name:"disabled",v:!1}].map((e,n)=>f.jsx(on,{draggable:"false",to:`/pages/discounts/q/vql=active:${e.v}`,children:f.jsx(Ka,{value:e.name,bgColor:Ip(void 0)})},n))]})]}),Kce=({value:t,context:e,...n})=>{const r=e.item.active?"bg-teal-500":"bg-red-500",i="whitespace-nowrap pr-2 font-semibold text-base max-w-[150px] sm:max-w-max overflow-clip hover:overflow-x-auto",s=e.item.application.id===Zc.Manual.id;return f.jsxs("div",{className:i,children:[f.jsx("span",{children:t}),s&&f.jsx(zR,{className:`block --text-xl text-white --p-0.5
666
665
  align-middle text-center ${r}`}),!s&&f.jsx("span",{children:"AUTO",className:`block text-xs text-white w-fit px-1 border shelf-border-color-blend
667
666
  align-middle text-center ${r}`})]})},qce=[{key:"handle",name:"Code",comp:Kce},{key:"info.details.meta",name:"Type",comp:Wce},{key:"updated_at",name:"Last Updated",comp:Ss,comp_params:{className:"font-semibold"}},{key:void 0,name:"Actions",comp:Fr}],d7=({})=>{const{query_api:t,context:e,ref_actions:n,page:r,loading:i,error:s,queryCount:a,hasLoaded:o,resource:l,resource_is_probably_empty:c,actions:{onLimitChange:u,onReload:d,prev:h,next:p}}=Br("discounts","/pages/discounts");return f.jsx("div",{className:"h-full w-full",children:f.jsxs("div",{className:"max-w-[56rem] mx-auto",children:[f.jsx(pr,{should_onboard:c,overallCollectionCount:a,hasLoaded:o,resource:l}),f.jsx(de,{show:s,children:s==null?void 0:s.toString()}),f.jsx(Gce,{className:"mt-5"}),f.jsxs("div",{className:`w-full rounded-md overflow-hidden border
668
667
  shelf-border-color dark:shadow-slate-900
@@ -678,7 +677,7 @@ In order to be iterable, non-array objects must have a [Symbol.iterator]() metho
678
677
  rounded-lg w-full border pl-2 sm:px-3 --pl-3
679
678
  py-2 shadow-lg flex overflow-x-hidden
680
679
  flex-col justify-between h-full text-base`,children:[f.jsx("p",{children:`${t} Filter`,className:"shelf-text-minor-2 overflow-x-hidden whitespace-nowrap"}),f.jsxs("select",{value:"-1",className:"w-full h-9 bg-transparent outline-none text-gray-500 p-0",onChange:r=>e(r.currentTarget.value),children:[f.jsx("option",{children:"Add Filter",value:"-1",className:"p-0 appearance-none"},"-1"),n.map((r,i)=>f.jsx("option",{children:r.name,value:r.id},i))]})]})},jO=({value:t,onChange:e,types:n=["product","order"],context:r,...i})=>{const[s,a]=_.useState(t??[]),o=_.useCallback(d=>{a(d),e&&e(d)},[e]),l=_.useCallback((d,h)=>{s[d].value=h;const p=[...s];o(p)},[s,o]),c=_.useCallback(d=>{s.splice(d,1),o([...s])},[s,o]),u=_.useCallback(d=>{const h=a0.find(g=>g.id==d),p={meta:{id:h.id,type:h.type,op:h.op},value:void 0},m=[...s,p];o(m)},[s,o,a0]);return f.jsxs("div",{className:"w-full",children:[f.jsx("div",{className:"flex flex-row gap-4 mt-3 w-full ",children:n.map((d,h)=>f.jsx(ot,{className:"flex-1",rounded:"rounded-lg",children:f.jsx(Whe,{type:d,onAdd:u})},h))}),f.jsx(de,{show:s.length,children:f.jsx("p",{children:"",className:`mt-5 h-0.5 mb-5 bg-gradient-to-r
681
- from-pink-500/50 to-kf-500/50`})}),f.jsx("div",{className:"w-full flex flex-col gap-5",children:s.map((d,h)=>{var p,m,g;return _.createElement(Vhe,{...Yhe((p=d==null?void 0:d.meta)==null?void 0:p.id),context:r,onChange:y=>l(h,y),onRemove:()=>c(h),key:h,ix:h,value:d.value,id:String((m=d.meta)==null?void 0:m.id),type:(g=d.meta)==null?void 0:g.type})})})]})},Ghe=t=>t===void 0?[!1,"You have to choose a Discount"]:[!0,void 0],tE=[{id:0,type:"regular",name:"Regular Discount",desc:"All Filtered products you defined will get the same discount. For Example: Every shirt will have 10% discount"},{id:1,type:"bulk",name:"Bulk Discount",desc:"Set an exact bulk discount on filtered products. for Example, 3 for 100$, 5 for 5% off"},{id:2,type:"buy_x_get_y",name:"Buy X Get Y",desc:"Buy some from the filtered products and get Y for discount. For Example: Buy 3 pants, get a Shirt for 50% off"},{id:3,type:"order",name:"Order Discount",desc:"Offer a discount on the total order including perks such as Free Shipping"},{id:4,type:"bundle",name:"Bundle Discount",desc:"Offer a discount on a bundle of products. For Example, buy a Laptop + Headset at discount 💲"}],Khe=({selectedType:t,onChange:e})=>{const n=_.useMemo(()=>{var i;return(i=tE.find(s=>s.id===(t==null?void 0:t.id)))==null?void 0:i.desc},[t,tE]),r=({type:i})=>f.jsxs("div",{className:"",children:[f.jsx("input",{type:"radio",id:i.type,name:"discount_type",value:i.type,className:"accent-pink-500",checked:i.type===(t==null?void 0:t.type),onChange:s=>e(i)}),f.jsx("label",{htmlFor:i.type,children:i.name,onClick:s=>e(i),className:"mx-3"})]});return f.jsxs("div",{className:"flex flex-row flex-wrap gap-5 --items-start",children:[f.jsx("div",{className:"flex flex-col gap-2 --flex-shrink-0 w-fit",children:Object.values(Er).map((i,s)=>f.jsx(r,{type:i},i.type))}),f.jsx("div",{className:"pl-5 border-l-2 shelf-border-color flex-1 min-w-[13rem]",children:f.jsx("p",{children:n,className:"text-gray-500 text-sm tracking-wide"})})]})},qhe=(t,e,n)=>{e=Number.isNaN(e)?0:e,n=Number.isNaN(n)?0:n;const r=(100-e)/100,i=Number.isNaN(n)?"":Math.abs(n)!=0?`${n<0?" - ":" + "} ${Math.abs(n)}`:"";let s=(100-e)/100;return s=typeof r=="number"&&!Number.isNaN(r)?r:"(100 - Percents)/100",s==0?Number.isNaN(n)?0:n:s==1?t+i:t+" * "+s+i},Qhe=({type:t,value:e,onChange:n})=>{const[r,i]=_.useState(e),s=_.useCallback((a,o)=>{const l={...r,[a]:o};i(l),n(l)},[r,n]);return f.jsxs("div",{className:"shelf-text-title-color",children:[f.jsx("p",{children:"Quantity Discount",className:"text-lg font-bold "}),f.jsxs("div",{className:`w-full mt-3 flex flex-row gap-3 items-end
680
+ from-pink-500/50 to-kf-500/50`})}),f.jsx("div",{className:"w-full flex flex-col gap-5",children:s.map((d,h)=>{var p,m,g;return _.createElement(Vhe,{...Yhe((p=d==null?void 0:d.meta)==null?void 0:p.id),context:r,onChange:y=>l(h,y),onRemove:()=>c(h),key:h,ix:h,value:d.value,id:String((m=d.meta)==null?void 0:m.id),type:(g=d.meta)==null?void 0:g.type})})})]})},Ghe=t=>t===void 0?[!1,"You have to choose a Discount"]:[!0,void 0],tE=[{id:0,type:"regular",name:"Regular Discount",desc:"All Filtered products you defined will get the same discount. For Example: Every shirt will have 10% discount"},{id:1,type:"bulk",name:"Bulk Discount",desc:"Set an exact bulk discount on filtered products. for Example, 3 for 100$, 5 for 5% off"},{id:2,type:"buy_x_get_y",name:"Buy X Get Y",desc:"Buy some from the filtered products and get Y for discount. For Example: Buy 3 pants, get a Shirt for 50% off"},{id:3,type:"order",name:"Order Discount",desc:"Offer a discount on the total order including perks such as Free Shipping"},{id:4,type:"bundle",name:"Bundle Discount",desc:"Offer a discount on a bundle of products. For Example, buy a Laptop + Headset at discount 💲"}],Khe=({selectedType:t,onChange:e})=>{const n=_.useMemo(()=>{var i;return(i=tE.find(s=>s.id===(t==null?void 0:t.id)))==null?void 0:i.desc},[t,tE]),r=({type:i})=>f.jsxs("div",{className:"",children:[f.jsx("input",{type:"radio",id:i.type,name:"discount_type",value:i.type,className:"accent-pink-500",checked:i.type===(t==null?void 0:t.type),onChange:s=>e(i)}),f.jsx("label",{htmlFor:i.type,children:i.name,onClick:s=>e(i),className:"mx-3"})]});return f.jsxs("div",{className:"flex flex-row flex-wrap gap-5 --items-start",children:[f.jsx("div",{className:"flex flex-col gap-2 --flex-shrink-0 w-fit",children:Object.values(Er).filter(i=>i.type).map((i,s)=>f.jsx(r,{type:i},i.type))}),f.jsx("div",{className:"pl-5 border-l-2 shelf-border-color flex-1 min-w-[13rem]",children:f.jsx("p",{children:n,className:"text-gray-500 text-sm tracking-wide"})})]})},qhe=(t,e,n)=>{e=Number.isNaN(e)?0:e,n=Number.isNaN(n)?0:n;const r=(100-e)/100,i=Number.isNaN(n)?"":Math.abs(n)!=0?`${n<0?" - ":" + "} ${Math.abs(n)}`:"";let s=(100-e)/100;return s=typeof r=="number"&&!Number.isNaN(r)?r:"(100 - Percents)/100",s==0?Number.isNaN(n)?0:n:s==1?t+i:t+" * "+s+i},Qhe=({type:t,value:e,onChange:n})=>{const[r,i]=_.useState(e),s=_.useCallback((a,o)=>{const l={...r,[a]:o};i(l),n(l)},[r,n]);return f.jsxs("div",{className:"shelf-text-title-color",children:[f.jsx("p",{children:"Quantity Discount",className:"text-lg font-bold "}),f.jsxs("div",{className:`w-full mt-3 flex flex-row gap-3 items-end
682
681
  flex-wrap text-base `,children:[f.jsxs("p",{children:[f.jsx(ir,{children:"Customer"})," buys a ",f.jsx(ir,{children:"Quantity"})," of"]}),f.jsx(qe,{type:"number",min:"1",step:"1",onWheel:a=>a.target.blur(),value:r.qty,onChange:a=>s("qty",Math.max(parseInt(a.currentTarget.value),1)),inputClsName:"h-7",stroke:"border-b",className:"rounded-md w-14"}),f.jsxs("p",{children:[f.jsx(ir,{children:"products"})," specified by the filters ",f.jsx("b",{children:"ABOVE ⬆️"})]})]}),f.jsx("p",{children:`How to discount a bulk of ${r.qty} items`,className:"text-lg font-bold mt-6"}),f.jsxs("div",{className:"w-full mt-5 flex flex-row flex-wrap gap-3 items-center ",children:[f.jsx("label",{children:"Percents off"}),f.jsx(qe,{type:"number",min:"0",max:"100",step:"1",onWheel:a=>a.target.blur(),value:r.percent,onChange:a=>s("percent",Math.min(parseFloat(a.currentTarget.value),100)),inputClsName:"h-7",className:"rounded-lg w-16"}),f.jsx("span",{children:"+",className:"text-2xl font-bold"}),f.jsxs("div",{className:"flex flex-row items-center gap-3",children:[f.jsx("label",{children:"Fixed Price"}),f.jsx(qe,{type:"number",value:r.fixed,onWheel:a=>a.target.blur(),onChange:a=>s("fixed",parseFloat(a.currentTarget.value)),inputClsName:"h-7",className:"rounded-lg w-16"})]})]}),f.jsx("p",{children:"* Fixed Price may be negative.",className:"text-sm mt-5 tracking-wider"}),f.jsx("p",{children:"Other Options",className:"text-lg font-bold mt-6"}),f.jsxs("div",{className:"flex flex-row gap-3 items-center mt-5",children:[f.jsx("input",{id:"cb_recursive",type:"checkbox",checked:r.recursive===!0,onChange:a=>s("recursive",!r.recursive),className:`w-4 h-4 accent-pink-500 border-0 rounded-md
683
682
  focus:ring-0`}),f.jsx("label",{htmlFor:"cb_recursive",children:"Recursive"}),f.jsx("span",{children:"(Apply the discount as much as possible)",className:" text-sm"})]}),f.jsx(Lf,{prefix:`total price of ${Number.isNaN(r==null?void 0:r.qty)?1:r.qty}`,percent:r==null?void 0:r.percent,fixed:r==null?void 0:r.fixed})]})},Zhe=t=>{switch(t.meta.op){case Qt.p_all.op:return f.jsxs(f.Fragment,{children:[f.jsx("b",{children:"any"})," product"]});case Qt.p_in_collections.op:{const e=t.value??[];return f.jsxs(f.Fragment,{children:["a product, that belongs to any of the following ",f.jsx("b",{children:"collections"}),":",f.jsx("ol",{className:"list-disc list-inside",children:e.map((n,r)=>f.jsx("li",{children:n.title,className:"font-semibold shelf-text-label-color-second"},r))})]})}case Qt.p_not_in_collections.op:{const e=t.value??[];return f.jsxs(f.Fragment,{children:["a product, that ",f.jsx("span",{className:"underline",children:"does not"}),"  belong to the following ",f.jsx("b",{children:"collections"}),":",f.jsx("ol",{className:"list-disc list-inside",children:e.map((n,r)=>f.jsx("li",{children:n.title,className:"font-semibold shelf-text-label-color-second"},r))})]})}case Qt.p_in_tags.op:{const e=t.value??[];return f.jsxs(f.Fragment,{children:["a product, that has any of the following ",f.jsx("b",{children:"tags"}),":",f.jsx("ol",{className:"list-disc list-inside",children:e.map((n,r)=>f.jsx("li",{children:n,className:"font-semibold shelf-text-label-color-second"},r))})]})}case Qt.p_not_in_tags.op:{const e=t.value??[];return f.jsxs(f.Fragment,{children:["a product, that has ",f.jsx("span",{className:"underline",children:"does not"}),"  have any of the following ",f.jsx("b",{children:"tags"}),":",f.jsx("ol",{className:"list-disc list-inside",children:e.map((n,r)=>f.jsx("li",{children:n,className:"font-semibold shelf-text-label-color-second"},r))})]})}case Qt.p_in_products.op:{const e=t.value??[];return f.jsxs(f.Fragment,{children:["a product, that is any of the ",f.jsx("b",{children:"following"}),":",f.jsx("ol",{className:"list-disc list-inside",children:e.map((n,r)=>f.jsx("li",{children:n.title,className:"font-semibold shelf-text-label-color-second"},r))})]})}case Qt.p_not_in_products.op:{const e=t.value??[];return f.jsxs(f.Fragment,{children:["a product, that is ",f.jsx("span",{className:"underline",children:"not"}),"any of the following ",f.jsx("b",{children:"products"}),":",f.jsx("ol",{className:"list-disc list-inside",children:e.map((n,r)=>f.jsx("li",{children:n.title,className:"font-semibold shelf-text-label-color-second"},r))})]})}case Qt.p_in_price_range.op:{const e=t.value;return f.jsxs(f.Fragment,{children:["a product, that is ",f.jsx("b",{children:"priced"})," between",f.jsx("b",{children:` ${(e==null?void 0:e.from)??0}`,className:"shelf-text-label-color-second"})," to",f.jsx("b",{className:"shelf-text-label-color-second",children:` ${(e==null?void 0:e.to)??"Infinity"}`})]})}default:return"WHAT"}},Xhe=t=>{switch(t){case 1:return"1st";case 2:return"2nd";case 3:return"3rd";default:return`${t}th`}},nE=t=>t.meta.type==="product",Jhe=({meta:t,value:e,context:n,onChange:r})=>{const[i,s]=_.useState([]),[a,o]=_.useState(e);_.useEffect(()=>{var u;return(()=>{var h;const d=((h=n==null?void 0:n.query["info.filters"])==null?void 0:h.get())??[];s([...d].filter(nE))})(),(u=n==null?void 0:n.pubsub)==null?void 0:u.add_sub((d,h=[])=>{d==="info.filters"&&s(h.filter(nE))})},[n]);const l=_.useCallback((c,u)=>{const d={...a,[c]:u};o(d),r(d)},[a,r]);return f.jsxs("div",{className:"shelf-text-title-color",children:[f.jsx("p",{children:"Bundle Breakdown",className:"text-lg font-bold "}),f.jsxs("div",{className:`w-full mt-2 flex flex-col gap-3 --items-end
684
683
  text-base `,children:[f.jsx(de,{show:i==null?void 0:i.length,children:i.map((c,u)=>f.jsxs("div",{children:[f.jsxs("div",{children:[f.jsx(ir,{children:Xhe(u+1),className:"text-lg shelf-text-label-color"})," item in bundle is ",Zhe(c)]}),f.jsx(Ct,{})]},u))}),f.jsx(de,{show:!(i!=null&&i.length),children:f.jsxs("p",{className:"text-base mt-3",children:["Use the ",f.jsx(ir,{children:"products"})," filters ",f.jsx("b",{children:"ABOVE ⬆️"}),". ",f.jsx("br",{}),"Each ",f.jsx(ir,{children:"filter"})," is a bundle item"]})})]}),f.jsx("p",{children:"How to discount a Bundle",className:"text-lg font-bold mt-6"}),f.jsxs("div",{className:"w-full mt-5 flex flex-row flex-wrap gap-3 items-center ",children:[f.jsx("label",{children:"Percents off"}),f.jsx(qe,{type:"number",min:"0",max:"100",step:"1",onWheel:c=>c.target.blur(),value:a.percent,onChange:c=>l("percent",Math.min(parseFloat(c.currentTarget.value),100)),inputClsName:"h-7",className:"rounded-lg w-16"}),f.jsx("span",{children:"+",className:"text-2xl font-bold"}),f.jsxs("div",{className:"flex flex-row items-center gap-3",children:[f.jsx("label",{children:"Fixed Price"}),f.jsx(qe,{type:"number",value:a.fixed,onWheel:c=>c.target.blur(),onChange:c=>l("fixed",parseFloat(c.currentTarget.value)),inputClsName:"h-7",className:"rounded-lg w-16"})]})]}),f.jsx("p",{children:"* Fixed Price may be negative. ",className:"text-sm mt-5 tracking-wider"}),f.jsx("p",{children:"Other Options",className:"text-lg font-bold mt-6"}),f.jsxs("div",{className:"flex flex-row gap-3 items-center mt-5",children:[f.jsx("input",{id:"cb_recursive",type:"checkbox",checked:a.recursive===!0,onChange:c=>l("recursive",!a.recursive),className:`w-4 h-4 accent-pink-500 border-0 rounded-md
@@ -728,14 +727,13 @@ Decide whether the discount is:
728
727
  shelf-input-color shelf-border-color border rounded-md`,children:[f.jsx(Xt,{className:`rounded-md overflow-x-scroll
729
728
  text-base min-h-8 align-middle
730
729
  flex flex-row items-center`,value:t}),f.jsx(Rv,{value:t,process_before_copy:e})]})}),Kpe=({user:t,removePromise:e})=>f.jsxs("div",{className:`flex flex-row justify-between items-center
731
- w-full shelf-input-color p-2 rounded-md `,children:[f.jsxs("div",{className:"w-3/4 overflow-x-scroll ",children:[f.jsx("p",{children:"email: "+t.email,className:"font-mono whitespace-nowrap"}),f.jsx("p",{children:`created at ${new Date(t.created_at).toLocaleDateString()}`,className:"font-mono"})]}),f.jsx(Zr,{text:"revoke",Icon:f.jsx(MH,{}),className:"h-6",rounded:"rounded-md",keep_text_on_load:!0,onClick:()=>e(t)})]}),qpe=({...t})=>{var p,m;const{actions:{apikeys:{create:e,list:n},users:{remove:r}}}=mv(),[i,s]=_.useState([]),[a,o]=_.useState(""),[l,c]=_.useState();_.useEffect(()=>{u()},[]);const u=_.useCallback(()=>{n().then(s).catch(c)},[]),d=_.useCallback(g=>r(g.id).then(u).catch(c),[]),h=_.useCallback(()=>e().then(g=>{o(g),u()}).catch(c),[]);return f.jsxs(fa,{name:"🔑 API Keys",desc:"Manage your API keys",border:!0,error:(m=(p=l==null?void 0:l.messages)==null?void 0:p[0])==null?void 0:m.message,setError:c,...t,children:[f.jsx("div",{className:"flex flex-col gap-3 w-full max-h-56 overflow-y-scroll",children:i.map(g=>f.jsx(Kpe,{user:g,removePromise:d},g.email))}),f.jsxs("div",{className:"flex flex-col gap-3 mt-3 w-full",children:[f.jsx(_s,{Icon:void 0,text:"+ create new api key",show:!0,onClick:h,keep_text_on_load:!0,classNameLoading:"text-xs",className:"w-fit text-base shelf-text-label-color underline self-end "}),f.jsxs(de,{show:a,children:[f.jsx(Ct,{className:"my-2"}),f.jsx("span",{children:"latest api key (only visible to you)"}),f.jsx(Gpe,{value:`\`${a}\``,process_before_copy:g=>g.slice(1,-1)})]})]})]})},Qpe=({...t})=>{var d,h;const{auth:e,actions:{changePassword:n}}=mv(),r=_.useRef(),i=_.useRef(),s=_.useRef(),[a,o]=_.useState(),[l,c]=_.useState(!1),u=_.useCallback(async()=>{try{c(!1),await n({user_id_or_email:e.user_id,current_password:String(r.current.value),new_password:String(i.current.value),confirm_new_password:String(s.current.value)}),c(!0)}catch(p){console.log("ee ",p),o(p)}},[n]);return f.jsxs(fa,{name:"🔑 Change Password",desc:"Change Your Password",border:!0,error:(h=(d=a==null?void 0:a.messages)==null?void 0:d[0])==null?void 0:h.message,setError:o,...t,children:[f.jsx("div",{className:"flex flex-col gap-3 w-full max-h-56 overflow-y-scroll"}),f.jsxs("div",{className:"flex flex-col gap-3 --mt-3 w-full",children:[f.jsx("p",{children:"Current Password"}),f.jsx(qe,{stroke:"border-none",ref:r}),f.jsx("p",{children:"New Password"}),f.jsx(qe,{stroke:"border-none",ref:i}),f.jsx("p",{children:"Confirm New Password"}),f.jsx(qe,{stroke:"border-none",ref:s}),f.jsxs("div",{className:"w-full flex flex-row justify-between mt-3",children:[f.jsxs(nv,{toggle:l,children:[f.jsxs("div",{className:"w-full flex flex-row items-center gap-2 text-xl text-green-500 dark:text-green-400",children:[f.jsx(ZP,{}),f.jsx("span",{children:"All done",className:"text-base font-normal"})]}),f.jsx("span",{})]}),f.jsx(Zr,{Icon:f.jsx(VR,{}),text:"update",show:!0,onClick:u,keep_text_on_load:!0,classNameLoading:"text-xs",rounded:"rounded-md",className:"w-fit text-base shelf-text-label-color self-end "})]})]})]})},Zpe=t=>{let e=`Here is what you need to know:
730
+ w-full shelf-input-color p-2 rounded-md `,children:[f.jsxs("div",{className:"w-3/4 overflow-x-scroll ",children:[f.jsx("p",{children:"email: "+t.email,className:"font-mono whitespace-nowrap"}),f.jsx("p",{children:`created at ${new Date(t.created_at).toLocaleDateString()}`,className:"font-mono"})]}),f.jsx(Zr,{text:"revoke",Icon:f.jsx(MH,{}),className:"h-6",rounded:"rounded-md",keep_text_on_load:!0,onClick:()=>e(t)})]}),qpe=({...t})=>{var p,m;const{actions:{apikeys:{create:e,list:n},users:{remove:r}}}=mv(),[i,s]=_.useState([]),[a,o]=_.useState(""),[l,c]=_.useState();_.useEffect(()=>{u()},[]);const u=_.useCallback(()=>{n().then(s).catch(c)},[]),d=_.useCallback(g=>r(g.id).then(u).catch(c),[]),h=_.useCallback(()=>e().then(g=>{o(g),u()}).catch(c),[]);return f.jsxs(fa,{name:"🔑 API Keys",desc:"Manage your API keys",border:!0,error:(m=(p=l==null?void 0:l.messages)==null?void 0:p[0])==null?void 0:m.message,setError:c,...t,children:[f.jsx("div",{className:"flex flex-col gap-3 w-full max-h-56 overflow-y-scroll",children:i.map(g=>f.jsx(Kpe,{user:g,removePromise:d},g.email))}),f.jsxs("div",{className:"flex flex-col gap-3 mt-3 w-full",children:[f.jsx(_s,{Icon:void 0,text:"+ create new api key",show:!0,onClick:h,keep_text_on_load:!0,classNameLoading:"text-xs",className:"w-fit text-base shelf-text-label-color underline self-end "}),f.jsxs(de,{show:a,children:[f.jsx(Ct,{className:"my-2"}),f.jsx("span",{children:"latest api key (only visible to you)"}),f.jsx(Gpe,{value:`\`${a}\``,process_before_copy:g=>g.slice(1,-1)})]})]})]})},Qpe=({...t})=>{var d,h;const{auth:e,actions:{changePassword:n}}=mv(),r=_.useRef(),i=_.useRef(),s=_.useRef(),[a,o]=_.useState(),[l,c]=_.useState(!1),u=_.useCallback(async()=>{try{c(!1),await n({user_id_or_email:e.user_id,current_password:String(r.current.value),new_password:String(i.current.value),confirm_new_password:String(s.current.value)}),c(!0)}catch(p){console.log("ee ",p),o(p)}},[n]);return f.jsxs(fa,{name:"🔑 Change Password",desc:"Change Your Password",border:!0,error:(h=(d=a==null?void 0:a.messages)==null?void 0:d[0])==null?void 0:h.message,setError:o,...t,children:[f.jsx("div",{className:"flex flex-col gap-3 w-full max-h-56 overflow-y-scroll"}),f.jsxs("div",{className:"flex flex-col gap-3 --mt-3 w-full",children:[f.jsx("p",{children:"Current Password"}),f.jsx(qe,{stroke:"border-none",ref:r}),f.jsx("p",{children:"New Password"}),f.jsx(qe,{stroke:"border-none",ref:i}),f.jsx("p",{children:"Confirm New Password"}),f.jsx(qe,{stroke:"border-none",ref:s}),f.jsxs("div",{className:"w-full flex flex-row justify-between mt-3",children:[f.jsxs(nv,{toggle:l,children:[f.jsxs("div",{className:"w-full flex flex-row items-center gap-2 text-xl text-green-500 dark:text-green-400",children:[f.jsx(ZP,{}),f.jsx("span",{children:"All done",className:"text-base font-normal"})]}),f.jsx("span",{})]}),f.jsx(Zr,{Icon:f.jsx(VR,{}),text:"update",show:!0,onClick:u,keep_text_on_load:!0,classNameLoading:"text-xs",rounded:"rounded-md",className:"w-fit text-base shelf-text-label-color self-end "})]})]})]})},Zpe=t=>{var n,r;let e=`Here is what you need to know:
732
731
 
733
732
  `;return t!=null&&t.auth_admins_emails&&(e=`- The following are the **admin** emails:
734
- `+(t==null?void 0:t.auth_admins_emails.map(n=>` - ${n}`).join(`
735
- `))),t!=null&&t.auth_password_hash_rounds&&(e+=`
736
- - Passwords are hashed with **${t==null?void 0:t.auth_password_hash_rounds}** rounds`),t!=null&&t.auth_secret_access_token&&(e+=`
737
- - **JWT** access token \`secret\` is **${t==null?void 0:t.auth_secret_access_token}**`),t!=null&&t.auth_secret_refresh_token&&(e+=`
738
- - **JWT** refresh token \`secret\` is **${t==null?void 0:t.auth_secret_refresh_token}**`),e},Xpe=t=>{const e=(t==null?void 0:t.general_store_name)??"unknown right now",n=(t==null?void 0:t.general_store_website)??"unknown right now",r=(t==null?void 0:t.general_store_support_email)??"unknown right now",i=(t==null?void 0:t.general_store_description)??"You still have not written one";return`Hi 👋, **your** store name is \`${e}\`, your store's
733
+ `+(t==null?void 0:t.auth_admins_emails.map(i=>` - ${i}`).join(`
734
+ `))),t!=null&&t.auth_secret_access_token&&(e+=`
735
+ - **JWT** access token \`secret\` is **${((n=t==null?void 0:t.auth_secret_access_token)==null?void 0:n.slice(0,4))+"------------"}**`),t!=null&&t.auth_secret_refresh_token&&(e+=`
736
+ - **JWT** refresh token \`secret\` is **${((r=t==null?void 0:t.auth_secret_refresh_token)==null?void 0:r.slice(0,4))+"------------"}**`),e},Xpe=t=>{const e=(t==null?void 0:t.general_store_name)??"unknown right now",n=(t==null?void 0:t.general_store_website)??"unknown right now",r=(t==null?void 0:t.general_store_support_email)??"unknown right now",i=(t==null?void 0:t.general_store_description)??"You still have not written one";return`Hi 👋, **your** store name is \`${e}\`, your store's
739
737
  website is ${n} and the support email is ${r} .
740
738
 
741
739