picture-designer 0.1.2 → 0.1.3
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.
|
@@ -19281,6 +19281,7 @@ function IR({ className: l, ...r }) {
|
|
|
19281
19281
|
);
|
|
19282
19282
|
}
|
|
19283
19283
|
function tO({ apiUrl: l, productId: r, imageUrl: i }) {
|
|
19284
|
+
console.log("0.1.3");
|
|
19284
19285
|
const [o, s] = S.useState(), [f, d] = S.useState(), [h, g] = S.useState(!1), [p, v] = S.useState(!1), b = S.useRef(null), T = async (x) => await wT(x, {
|
|
19285
19286
|
cacheBust: !0,
|
|
19286
19287
|
pixelRatio: 1,
|
|
@@ -141,4 +141,4 @@ For more information, see https://radix-ui.com/primitives/docs/components/${r.do
|
|
|
141
141
|
`)}getSetCookie(){return this.get("set-cookie")||[]}get[Symbol.toStringTag](){return"AxiosHeaders"}static from(r){return r instanceof this?r:new this(r)}static concat(r,...i){const o=new this(r);return i.forEach(s=>o.set(s)),o}static accessor(r){const o=(this[Sm]=this[Sm]={accessors:{}}).accessors,s=this.prototype;function f(d){const h=Qa(d);o[h]||(Jw(s,d),o[h]=!0)}return j.isArray(r)?r.forEach(f):f(r),this}};dt.accessor(["Content-Type","Content-Length","Accept","Accept-Encoding","User-Agent","Authorization"]),j.reduceDescriptors(dt.prototype,({value:l},r)=>{let i=r[0].toUpperCase()+r.slice(1);return{get:()=>l,set(o){this[i]=o}}}),j.freezeMethods(dt);function es(l,r){const i=this||Xa,o=r||i,s=dt.from(o.headers);let f=o.data;return j.forEach(l,function(h){f=h.call(i,f,s.normalize(),r?r.status:void 0)}),s.normalize(),f}function Em(l){return!!(l&&l.__CANCEL__)}function Zl(l,r,i){fe.call(this,l??"canceled",fe.ERR_CANCELED,r,i),this.name="CanceledError"}j.inherits(Zl,fe,{__CANCEL__:!0});function xm(l,r,i){const o=i.config.validateStatus;!i.status||!o||o(i.status)?l(i):r(new fe("Request failed with status code "+i.status,[fe.ERR_BAD_REQUEST,fe.ERR_BAD_RESPONSE][Math.floor(i.status/100)-4],i.config,i.request,i))}function Ww(l){const r=/^([-+\w]{1,25})(:?\/\/|:)/.exec(l);return r&&r[1]||""}function Iw(l,r){l=l||10;const i=new Array(l),o=new Array(l);let s=0,f=0,d;return r=r!==void 0?r:1e3,function(g){const p=Date.now(),v=o[f];d||(d=p),i[s]=g,o[s]=p;let b=f,T=0;for(;b!==s;)T+=i[b++],b=b%l;if(s=(s+1)%l,s===f&&(f=(f+1)%l),p-d<r)return;const C=v&&p-v;return C?Math.round(T*1e3/C):void 0}}function eA(l,r){let i=0,o=1e3/r,s,f;const d=(p,v=Date.now())=>{i=v,s=null,f&&(clearTimeout(f),f=null),l(...p)};return[(...p)=>{const v=Date.now(),b=v-i;b>=o?d(p,v):(s=p,f||(f=setTimeout(()=>{f=null,d(s)},o-b)))},()=>s&&d(s)]}const Ri=(l,r,i=3)=>{let o=0;const s=Iw(50,250);return eA(f=>{const d=f.loaded,h=f.lengthComputable?f.total:void 0,g=d-o,p=s(g),v=d<=h;o=d;const b={loaded:d,total:h,progress:h?d/h:void 0,bytes:g,rate:p||void 0,estimated:p&&h&&v?(h-d)/p:void 0,event:f,lengthComputable:h!=null,[r?"download":"upload"]:!0};l(b)},i)},wm=(l,r)=>{const i=l!=null;return[o=>r[0]({lengthComputable:i,total:l,loaded:o}),r[1]]},Am=l=>(...r)=>j.asap(()=>l(...r)),tA=at.hasStandardBrowserEnv?((l,r)=>i=>(i=new URL(i,at.origin),l.protocol===i.protocol&&l.host===i.host&&(r||l.port===i.port)))(new URL(at.origin),at.navigator&&/(msie|trident)/i.test(at.navigator.userAgent)):()=>!0,nA=at.hasStandardBrowserEnv?{write(l,r,i,o,s,f,d){if(typeof document>"u")return;const h=[`${l}=${encodeURIComponent(r)}`];j.isNumber(i)&&h.push(`expires=${new Date(i).toUTCString()}`),j.isString(o)&&h.push(`path=${o}`),j.isString(s)&&h.push(`domain=${s}`),f===!0&&h.push("secure"),j.isString(d)&&h.push(`SameSite=${d}`),document.cookie=h.join("; ")},read(l){if(typeof document>"u")return null;const r=document.cookie.match(new RegExp("(?:^|; )"+l+"=([^;]*)"));return r?decodeURIComponent(r[1]):null},remove(l){this.write(l,"",Date.now()-864e5,"/")}}:{write(){},read(){return null},remove(){}};function lA(l){return/^([a-z][a-z\d+\-.]*:)?\/\//i.test(l)}function aA(l,r){return r?l.replace(/\/?\/$/,"")+"/"+r.replace(/^\/+/,""):l}function Tm(l,r,i){let o=!lA(r);return l&&(o||i==!1)?aA(l,r):r}const Rm=l=>l instanceof dt?{...l}:l;function cl(l,r){r=r||{};const i={};function o(p,v,b,T){return j.isPlainObject(p)&&j.isPlainObject(v)?j.merge.call({caseless:T},p,v):j.isPlainObject(v)?j.merge({},v):j.isArray(v)?v.slice():v}function s(p,v,b,T){if(j.isUndefined(v)){if(!j.isUndefined(p))return o(void 0,p,b,T)}else return o(p,v,b,T)}function f(p,v){if(!j.isUndefined(v))return o(void 0,v)}function d(p,v){if(j.isUndefined(v)){if(!j.isUndefined(p))return o(void 0,p)}else return o(void 0,v)}function h(p,v,b){if(b in r)return o(p,v);if(b in l)return o(void 0,p)}const g={url:f,method:f,data:f,baseURL:d,transformRequest:d,transformResponse:d,paramsSerializer:d,timeout:d,timeoutMessage:d,withCredentials:d,withXSRFToken:d,adapter:d,responseType:d,xsrfCookieName:d,xsrfHeaderName:d,onUploadProgress:d,onDownloadProgress:d,decompress:d,maxContentLength:d,maxBodyLength:d,beforeRedirect:d,transport:d,httpAgent:d,httpsAgent:d,cancelToken:d,socketPath:d,responseEncoding:d,validateStatus:h,headers:(p,v,b)=>s(Rm(p),Rm(v),b,!0)};return j.forEach(Object.keys({...l,...r}),function(v){const b=g[v]||s,T=b(l[v],r[v],v);j.isUndefined(T)&&b!==h||(i[v]=T)}),i}const Om=l=>{const r=cl({},l);let{data:i,withXSRFToken:o,xsrfHeaderName:s,xsrfCookieName:f,headers:d,auth:h}=r;if(r.headers=d=dt.from(d),r.url=gm(Tm(r.baseURL,r.url,r.allowAbsoluteUrls),l.params,l.paramsSerializer),h&&d.set("Authorization","Basic "+btoa((h.username||"")+":"+(h.password?unescape(encodeURIComponent(h.password)):""))),j.isFormData(i)){if(at.hasStandardBrowserEnv||at.hasStandardBrowserWebWorkerEnv)d.setContentType(void 0);else if(j.isFunction(i.getHeaders)){const g=i.getHeaders(),p=["content-type","content-length"];Object.entries(g).forEach(([v,b])=>{p.includes(v.toLowerCase())&&d.set(v,b)})}}if(at.hasStandardBrowserEnv&&(o&&j.isFunction(o)&&(o=o(r)),o||o!==!1&&tA(r.url))){const g=s&&f&&nA.read(f);g&&d.set(s,g)}return r},rA=typeof XMLHttpRequest<"u"&&function(l){return new Promise(function(i,o){const s=Om(l);let f=s.data;const d=dt.from(s.headers).normalize();let{responseType:h,onUploadProgress:g,onDownloadProgress:p}=s,v,b,T,C,w;function x(){C&&C(),w&&w(),s.cancelToken&&s.cancelToken.unsubscribe(v),s.signal&&s.signal.removeEventListener("abort",v)}let O=new XMLHttpRequest;O.open(s.method.toUpperCase(),s.url,!0),O.timeout=s.timeout;function H(){if(!O)return;const Z=dt.from("getAllResponseHeaders"in O&&O.getAllResponseHeaders()),$={data:!h||h==="text"||h==="json"?O.responseText:O.response,status:O.status,statusText:O.statusText,headers:Z,config:l,request:O};xm(function(Q){i(Q),x()},function(Q){o(Q),x()},$),O=null}"onloadend"in O?O.onloadend=H:O.onreadystatechange=function(){!O||O.readyState!==4||O.status===0&&!(O.responseURL&&O.responseURL.indexOf("file:")===0)||setTimeout(H)},O.onabort=function(){O&&(o(new fe("Request aborted",fe.ECONNABORTED,l,O)),O=null)},O.onerror=function(Y){const $=Y&&Y.message?Y.message:"Network Error",F=new fe($,fe.ERR_NETWORK,l,O);F.event=Y||null,o(F),O=null},O.ontimeout=function(){let Y=s.timeout?"timeout of "+s.timeout+"ms exceeded":"timeout exceeded";const $=s.transitional||vm;s.timeoutErrorMessage&&(Y=s.timeoutErrorMessage),o(new fe(Y,$.clarifyTimeoutError?fe.ETIMEDOUT:fe.ECONNABORTED,l,O)),O=null},f===void 0&&d.setContentType(null),"setRequestHeader"in O&&j.forEach(d.toJSON(),function(Y,$){O.setRequestHeader($,Y)}),j.isUndefined(s.withCredentials)||(O.withCredentials=!!s.withCredentials),h&&h!=="json"&&(O.responseType=s.responseType),p&&([T,w]=Ri(p,!0),O.addEventListener("progress",T)),g&&O.upload&&([b,C]=Ri(g),O.upload.addEventListener("progress",b),O.upload.addEventListener("loadend",C)),(s.cancelToken||s.signal)&&(v=Z=>{O&&(o(!Z||Z.type?new Zl(null,l,O):Z),O.abort(),O=null)},s.cancelToken&&s.cancelToken.subscribe(v),s.signal&&(s.signal.aborted?v():s.signal.addEventListener("abort",v)));const K=Ww(s.url);if(K&&at.protocols.indexOf(K)===-1){o(new fe("Unsupported protocol "+K+":",fe.ERR_BAD_REQUEST,l));return}O.send(f||null)})},iA=(l,r)=>{const{length:i}=l=l?l.filter(Boolean):[];if(r||i){let o=new AbortController,s;const f=function(p){if(!s){s=!0,h();const v=p instanceof Error?p:this.reason;o.abort(v instanceof fe?v:new Zl(v instanceof Error?v.message:v))}};let d=r&&setTimeout(()=>{d=null,f(new fe(`timeout ${r} of ms exceeded`,fe.ETIMEDOUT))},r);const h=()=>{l&&(d&&clearTimeout(d),d=null,l.forEach(p=>{p.unsubscribe?p.unsubscribe(f):p.removeEventListener("abort",f)}),l=null)};l.forEach(p=>p.addEventListener("abort",f));const{signal:g}=o;return g.unsubscribe=()=>j.asap(h),g}},oA=function*(l,r){let i=l.byteLength;if(i<r){yield l;return}let o=0,s;for(;o<i;)s=o+r,yield l.slice(o,s),o=s},uA=async function*(l,r){for await(const i of sA(l))yield*oA(i,r)},sA=async function*(l){if(l[Symbol.asyncIterator]){yield*l;return}const r=l.getReader();try{for(;;){const{done:i,value:o}=await r.read();if(i)break;yield o}}finally{await r.cancel()}},Cm=(l,r,i,o)=>{const s=uA(l,r);let f=0,d,h=g=>{d||(d=!0,o&&o(g))};return new ReadableStream({async pull(g){try{const{done:p,value:v}=await s.next();if(p){h(),g.close();return}let b=v.byteLength;if(i){let T=f+=b;i(T)}g.enqueue(new Uint8Array(v))}catch(p){throw h(p),p}},cancel(g){return h(g),s.return()}},{highWaterMark:2})},Dm=64*1024,{isFunction:Oi}=j,cA=(({Request:l,Response:r})=>({Request:l,Response:r}))(j.global),{ReadableStream:_m,TextEncoder:Mm}=j.global,Nm=(l,...r)=>{try{return!!l(...r)}catch{return!1}},fA=l=>{l=j.merge.call({skipUndefined:!0},cA,l);const{fetch:r,Request:i,Response:o}=l,s=r?Oi(r):typeof fetch=="function",f=Oi(i),d=Oi(o);if(!s)return!1;const h=s&&Oi(_m),g=s&&(typeof Mm=="function"?(w=>x=>w.encode(x))(new Mm):async w=>new Uint8Array(await new i(w).arrayBuffer())),p=f&&h&&Nm(()=>{let w=!1;const x=new i(at.origin,{body:new _m,method:"POST",get duplex(){return w=!0,"half"}}).headers.has("Content-Type");return w&&!x}),v=d&&h&&Nm(()=>j.isReadableStream(new o("").body)),b={stream:v&&(w=>w.body)};s&&["text","arrayBuffer","blob","formData","stream"].forEach(w=>{!b[w]&&(b[w]=(x,O)=>{let H=x&&x[w];if(H)return H.call(x);throw new fe(`Response type '${w}' is not supported`,fe.ERR_NOT_SUPPORT,O)})});const T=async w=>{if(w==null)return 0;if(j.isBlob(w))return w.size;if(j.isSpecCompliantForm(w))return(await new i(at.origin,{method:"POST",body:w}).arrayBuffer()).byteLength;if(j.isArrayBufferView(w)||j.isArrayBuffer(w))return w.byteLength;if(j.isURLSearchParams(w)&&(w=w+""),j.isString(w))return(await g(w)).byteLength},C=async(w,x)=>{const O=j.toFiniteNumber(w.getContentLength());return O??T(x)};return async w=>{let{url:x,method:O,data:H,signal:K,cancelToken:Z,timeout:Y,onDownloadProgress:$,onUploadProgress:F,responseType:Q,headers:J,withCredentials:ie="same-origin",fetchOptions:ce}=Om(w),Ce=r||fetch;Q=Q?(Q+"").toLowerCase():"text";let ve=iA([K,Z&&Z.toAbortSignal()],Y),he=null;const me=ve&&ve.unsubscribe&&(()=>{ve.unsubscribe()});let we;try{if(F&&p&&O!=="get"&&O!=="head"&&(we=await C(J,H))!==0){let A=new i(x,{method:"POST",body:H,duplex:"half"}),G;if(j.isFormData(H)&&(G=A.headers.get("content-type"))&&J.setContentType(G),A.body){const[W,P]=wm(we,Ri(Am(F)));H=Cm(A.body,Dm,W,P)}}j.isString(ie)||(ie=ie?"include":"omit");const k=f&&"credentials"in i.prototype,B={...ce,signal:ve,method:O.toUpperCase(),headers:J.normalize().toJSON(),body:H,duplex:"half",credentials:k?ie:void 0};he=f&&new i(x,B);let _=await(f?Ce(he,ce):Ce(x,B));const re=v&&(Q==="stream"||Q==="response");if(v&&($||re&&me)){const A={};["status","statusText","headers"].forEach(le=>{A[le]=_[le]});const G=j.toFiniteNumber(_.headers.get("content-length")),[W,P]=$&&wm(G,Ri(Am($),!0))||[];_=new o(Cm(_.body,Dm,W,()=>{P&&P(),me&&me()}),A)}Q=Q||"text";let pe=await b[j.findKey(b,Q)||"text"](_,w);return!re&&me&&me(),await new Promise((A,G)=>{xm(A,G,{data:pe,headers:dt.from(_.headers),status:_.status,statusText:_.statusText,config:w,request:he})})}catch(k){throw me&&me(),k&&k.name==="TypeError"&&/Load failed|fetch/i.test(k.message)?Object.assign(new fe("Network Error",fe.ERR_NETWORK,w,he),{cause:k.cause||k}):fe.from(k,k&&k.code,w,he)}}},dA=new Map,zm=l=>{let r=l&&l.env||{};const{fetch:i,Request:o,Response:s}=r,f=[o,s,i];let d=f.length,h=d,g,p,v=dA;for(;h--;)g=f[h],p=v.get(g),p===void 0&&v.set(g,p=h?new Map:fA(r)),v=p;return p};zm();const ts={http:Uw,xhr:rA,fetch:{get:zm}};j.forEach(ts,(l,r)=>{if(l){try{Object.defineProperty(l,"name",{value:r})}catch{}Object.defineProperty(l,"adapterName",{value:r})}});const Um=l=>`- ${l}`,hA=l=>j.isFunction(l)||l===null||l===!1;function mA(l,r){l=j.isArray(l)?l:[l];const{length:i}=l;let o,s;const f={};for(let d=0;d<i;d++){o=l[d];let h;if(s=o,!hA(o)&&(s=ts[(h=String(o)).toLowerCase()],s===void 0))throw new fe(`Unknown adapter '${h}'`);if(s&&(j.isFunction(s)||(s=s.get(r))))break;f[h||"#"+d]=s}if(!s){const d=Object.entries(f).map(([g,p])=>`adapter ${g} `+(p===!1?"is not supported by the environment":"is not available in the build"));let h=i?d.length>1?`since :
|
|
142
142
|
`+d.map(Um).join(`
|
|
143
143
|
`):" "+Um(d[0]):"as no adapter specified";throw new fe("There is no suitable adapter to dispatch the request "+h,"ERR_NOT_SUPPORT")}return s}const Lm={getAdapter:mA,adapters:ts};function ns(l){if(l.cancelToken&&l.cancelToken.throwIfRequested(),l.signal&&l.signal.aborted)throw new Zl(null,l)}function jm(l){return ns(l),l.headers=dt.from(l.headers),l.data=es.call(l,l.transformRequest),["post","put","patch"].indexOf(l.method)!==-1&&l.headers.setContentType("application/x-www-form-urlencoded",!1),Lm.getAdapter(l.adapter||Xa.adapter,l)(l).then(function(o){return ns(l),o.data=es.call(l,l.transformResponse,o),o.headers=dt.from(o.headers),o},function(o){return Em(o)||(ns(l),o&&o.response&&(o.response.data=es.call(l,l.transformResponse,o.response),o.response.headers=dt.from(o.response.headers))),Promise.reject(o)})}const Hm="1.13.2",Ci={};["object","boolean","number","function","string","symbol"].forEach((l,r)=>{Ci[l]=function(o){return typeof o===l||"a"+(r<1?"n ":" ")+l}});const Bm={};Ci.transitional=function(r,i,o){function s(f,d){return"[Axios v"+Hm+"] Transitional option '"+f+"'"+d+(o?". "+o:"")}return(f,d,h)=>{if(r===!1)throw new fe(s(d," has been removed"+(i?" in "+i:"")),fe.ERR_DEPRECATED);return i&&!Bm[d]&&(Bm[d]=!0,console.warn(s(d," has been deprecated since v"+i+" and will be removed in the near future"))),r?r(f,d,h):!0}},Ci.spelling=function(r){return(i,o)=>(console.warn(`${o} is likely a misspelling of ${r}`),!0)};function pA(l,r,i){if(typeof l!="object")throw new fe("options must be an object",fe.ERR_BAD_OPTION_VALUE);const o=Object.keys(l);let s=o.length;for(;s-- >0;){const f=o[s],d=r[f];if(d){const h=l[f],g=h===void 0||d(h,f,l);if(g!==!0)throw new fe("option "+f+" must be "+g,fe.ERR_BAD_OPTION_VALUE);continue}if(i!==!0)throw new fe("Unknown option "+f,fe.ERR_BAD_OPTION)}}const Di={assertOptions:pA,validators:Ci},en=Di.validators;let fl=class{constructor(r){this.defaults=r||{},this.interceptors={request:new ym,response:new ym}}async request(r,i){try{return await this._request(r,i)}catch(o){if(o instanceof Error){let s={};Error.captureStackTrace?Error.captureStackTrace(s):s=new Error;const f=s.stack?s.stack.replace(/^.+\n/,""):"";try{o.stack?f&&!String(o.stack).endsWith(f.replace(/^.+\n.+\n/,""))&&(o.stack+=`
|
|
144
|
-
`+f):o.stack=f}catch{}}throw o}}_request(r,i){typeof r=="string"?(i=i||{},i.url=r):i=r||{},i=cl(this.defaults,i);const{transitional:o,paramsSerializer:s,headers:f}=i;o!==void 0&&Di.assertOptions(o,{silentJSONParsing:en.transitional(en.boolean),forcedJSONParsing:en.transitional(en.boolean),clarifyTimeoutError:en.transitional(en.boolean)},!1),s!=null&&(j.isFunction(s)?i.paramsSerializer={serialize:s}:Di.assertOptions(s,{encode:en.function,serialize:en.function},!0)),i.allowAbsoluteUrls!==void 0||(this.defaults.allowAbsoluteUrls!==void 0?i.allowAbsoluteUrls=this.defaults.allowAbsoluteUrls:i.allowAbsoluteUrls=!0),Di.assertOptions(i,{baseUrl:en.spelling("baseURL"),withXsrfToken:en.spelling("withXSRFToken")},!0),i.method=(i.method||this.defaults.method||"get").toLowerCase();let d=f&&j.merge(f.common,f[i.method]);f&&j.forEach(["delete","get","head","post","put","patch","common"],w=>{delete f[w]}),i.headers=dt.concat(d,f);const h=[];let g=!0;this.interceptors.request.forEach(function(x){typeof x.runWhen=="function"&&x.runWhen(i)===!1||(g=g&&x.synchronous,h.unshift(x.fulfilled,x.rejected))});const p=[];this.interceptors.response.forEach(function(x){p.push(x.fulfilled,x.rejected)});let v,b=0,T;if(!g){const w=[jm.bind(this),void 0];for(w.unshift(...h),w.push(...p),T=w.length,v=Promise.resolve(i);b<T;)v=v.then(w[b++],w[b++]);return v}T=h.length;let C=i;for(;b<T;){const w=h[b++],x=h[b++];try{C=w(C)}catch(O){x.call(this,O);break}}try{v=jm.call(this,C)}catch(w){return Promise.reject(w)}for(b=0,T=p.length;b<T;)v=v.then(p[b++],p[b++]);return v}getUri(r){r=cl(this.defaults,r);const i=Tm(r.baseURL,r.url,r.allowAbsoluteUrls);return gm(i,r.params,r.paramsSerializer)}};j.forEach(["delete","get","head","options"],function(r){fl.prototype[r]=function(i,o){return this.request(cl(o||{},{method:r,url:i,data:(o||{}).data}))}}),j.forEach(["post","put","patch"],function(r){function i(o){return function(f,d,h){return this.request(cl(h||{},{method:r,headers:o?{"Content-Type":"multipart/form-data"}:{},url:f,data:d}))}}fl.prototype[r]=i(),fl.prototype[r+"Form"]=i(!0)});let gA=class Nv{constructor(r){if(typeof r!="function")throw new TypeError("executor must be a function.");let i;this.promise=new Promise(function(f){i=f});const o=this;this.promise.then(s=>{if(!o._listeners)return;let f=o._listeners.length;for(;f-- >0;)o._listeners[f](s);o._listeners=null}),this.promise.then=s=>{let f;const d=new Promise(h=>{o.subscribe(h),f=h}).then(s);return d.cancel=function(){o.unsubscribe(f)},d},r(function(f,d,h){o.reason||(o.reason=new Zl(f,d,h),i(o.reason))})}throwIfRequested(){if(this.reason)throw this.reason}subscribe(r){if(this.reason){r(this.reason);return}this._listeners?this._listeners.push(r):this._listeners=[r]}unsubscribe(r){if(!this._listeners)return;const i=this._listeners.indexOf(r);i!==-1&&this._listeners.splice(i,1)}toAbortSignal(){const r=new AbortController,i=o=>{r.abort(o)};return this.subscribe(i),r.signal.unsubscribe=()=>this.unsubscribe(i),r.signal}static source(){let r;return{token:new Nv(function(s){r=s}),cancel:r}}};function yA(l){return function(i){return l.apply(null,i)}}function vA(l){return j.isObject(l)&&l.isAxiosError===!0}const ls={Continue:100,SwitchingProtocols:101,Processing:102,EarlyHints:103,Ok:200,Created:201,Accepted:202,NonAuthoritativeInformation:203,NoContent:204,ResetContent:205,PartialContent:206,MultiStatus:207,AlreadyReported:208,ImUsed:226,MultipleChoices:300,MovedPermanently:301,Found:302,SeeOther:303,NotModified:304,UseProxy:305,Unused:306,TemporaryRedirect:307,PermanentRedirect:308,BadRequest:400,Unauthorized:401,PaymentRequired:402,Forbidden:403,NotFound:404,MethodNotAllowed:405,NotAcceptable:406,ProxyAuthenticationRequired:407,RequestTimeout:408,Conflict:409,Gone:410,LengthRequired:411,PreconditionFailed:412,PayloadTooLarge:413,UriTooLong:414,UnsupportedMediaType:415,RangeNotSatisfiable:416,ExpectationFailed:417,ImATeapot:418,MisdirectedRequest:421,UnprocessableEntity:422,Locked:423,FailedDependency:424,TooEarly:425,UpgradeRequired:426,PreconditionRequired:428,TooManyRequests:429,RequestHeaderFieldsTooLarge:431,UnavailableForLegalReasons:451,InternalServerError:500,NotImplemented:501,BadGateway:502,ServiceUnavailable:503,GatewayTimeout:504,HttpVersionNotSupported:505,VariantAlsoNegotiates:506,InsufficientStorage:507,LoopDetected:508,NotExtended:510,NetworkAuthenticationRequired:511,WebServerIsDown:521,ConnectionTimedOut:522,OriginIsUnreachable:523,TimeoutOccurred:524,SslHandshakeFailed:525,InvalidSslCertificate:526};Object.entries(ls).forEach(([l,r])=>{ls[r]=l});function qm(l){const r=new fl(l),i=em(fl.prototype.request,r);return j.extend(i,fl.prototype,r,{allOwnKeys:!0}),j.extend(i,r,null,{allOwnKeys:!0}),i.create=function(s){return qm(cl(l,s))},i}const Be=qm(Xa);Be.Axios=fl,Be.CanceledError=Zl,Be.CancelToken=gA,Be.isCancel=Em,Be.VERSION=Hm,Be.toFormData=Ai,Be.AxiosError=fe,Be.Cancel=Be.CanceledError,Be.all=function(r){return Promise.all(r)},Be.spread=yA,Be.isAxiosError=vA,Be.mergeConfig=cl,Be.AxiosHeaders=dt,Be.formToJSON=l=>bm(j.isHTMLForm(l)?new FormData(l):l),Be.getAdapter=Lm.getAdapter,Be.HttpStatusCode=ls,Be.default=Be;const{Axios:iO,AxiosError:oO,CanceledError:uO,isCancel:sO,CancelToken:cO,VERSION:fO,all:dO,Cancel:hO,isAxiosError:mO,spread:pO,toFormData:gO,AxiosHeaders:yO,HttpStatusCode:vO,formToJSON:bO,getAdapter:SO,mergeConfig:EO}=Be;function bA({className:l,...r}){return L.jsx(CS,{role:"status","aria-label":"Loading",className:_t("size-4 animate-spin",l),...r})}function SA({apiUrl:l,productId:r,imageUrl:i}){const[o,s]=S.useState(),[f,d]=S.useState(),[h,g]=S.useState(!1),[p,v]=S.useState(!1),b=S.useRef(null),T=async x=>await $x(x,{cacheBust:!0,pixelRatio:1,skipFonts:!1}),C=async()=>{if(b.current){g(!0),v(!0),await Nb(100);try{const x=await T(b.current),{data:O}=await Be.post(l,{productId:r,image:x});console.log(O),await Be.post("/cart/add.json",{items:[{id:O.id,quantity:1}]}),window.location.href="/cart"}catch(x){window.alert("Error while cropping or adding product to cart. Contact our manager."),console.error("Error while cropping or adding product to cart. Contact our manager."),console.error(x)}finally{g(!1),v(!1)}}},w=L.jsxs(ou,{onClick:C,disabled:h,children:[h&&L.jsx(bA,{})," Add to cart"]});return L.jsx(L.Fragment,{children:L.jsx(ex,{actionButton:w,heightValue:f,widthValue:o,onHeightChange:d,onWidthChange:s,children:L.jsxs("div",{className:"flex justify-center",children:[L.jsx("img",{className:"object-cover max-h-[70vh] border-2 border-dashed border-black",src:i,ref:b,style:{aspectRatio:`${o??"50"} / ${f??"50"}`,pointerEvents:"none",display:p?"block":"none"}}),L.jsx(tx,{width:o,height:f,imageUrl:i,generatingImg:p})]})})})}function EA(l,r){const i=typeof l=="string"?document.querySelector(l):l;Yv.createRoot(i).render(L.jsx(SA,{...r}))}return Qo.mountConstructorWidget=EA,Object.defineProperty(Qo,Symbol.toStringTag,{value:"Module"}),Qo}({});
|
|
144
|
+
`+f):o.stack=f}catch{}}throw o}}_request(r,i){typeof r=="string"?(i=i||{},i.url=r):i=r||{},i=cl(this.defaults,i);const{transitional:o,paramsSerializer:s,headers:f}=i;o!==void 0&&Di.assertOptions(o,{silentJSONParsing:en.transitional(en.boolean),forcedJSONParsing:en.transitional(en.boolean),clarifyTimeoutError:en.transitional(en.boolean)},!1),s!=null&&(j.isFunction(s)?i.paramsSerializer={serialize:s}:Di.assertOptions(s,{encode:en.function,serialize:en.function},!0)),i.allowAbsoluteUrls!==void 0||(this.defaults.allowAbsoluteUrls!==void 0?i.allowAbsoluteUrls=this.defaults.allowAbsoluteUrls:i.allowAbsoluteUrls=!0),Di.assertOptions(i,{baseUrl:en.spelling("baseURL"),withXsrfToken:en.spelling("withXSRFToken")},!0),i.method=(i.method||this.defaults.method||"get").toLowerCase();let d=f&&j.merge(f.common,f[i.method]);f&&j.forEach(["delete","get","head","post","put","patch","common"],w=>{delete f[w]}),i.headers=dt.concat(d,f);const h=[];let g=!0;this.interceptors.request.forEach(function(x){typeof x.runWhen=="function"&&x.runWhen(i)===!1||(g=g&&x.synchronous,h.unshift(x.fulfilled,x.rejected))});const p=[];this.interceptors.response.forEach(function(x){p.push(x.fulfilled,x.rejected)});let v,b=0,T;if(!g){const w=[jm.bind(this),void 0];for(w.unshift(...h),w.push(...p),T=w.length,v=Promise.resolve(i);b<T;)v=v.then(w[b++],w[b++]);return v}T=h.length;let C=i;for(;b<T;){const w=h[b++],x=h[b++];try{C=w(C)}catch(O){x.call(this,O);break}}try{v=jm.call(this,C)}catch(w){return Promise.reject(w)}for(b=0,T=p.length;b<T;)v=v.then(p[b++],p[b++]);return v}getUri(r){r=cl(this.defaults,r);const i=Tm(r.baseURL,r.url,r.allowAbsoluteUrls);return gm(i,r.params,r.paramsSerializer)}};j.forEach(["delete","get","head","options"],function(r){fl.prototype[r]=function(i,o){return this.request(cl(o||{},{method:r,url:i,data:(o||{}).data}))}}),j.forEach(["post","put","patch"],function(r){function i(o){return function(f,d,h){return this.request(cl(h||{},{method:r,headers:o?{"Content-Type":"multipart/form-data"}:{},url:f,data:d}))}}fl.prototype[r]=i(),fl.prototype[r+"Form"]=i(!0)});let gA=class Nv{constructor(r){if(typeof r!="function")throw new TypeError("executor must be a function.");let i;this.promise=new Promise(function(f){i=f});const o=this;this.promise.then(s=>{if(!o._listeners)return;let f=o._listeners.length;for(;f-- >0;)o._listeners[f](s);o._listeners=null}),this.promise.then=s=>{let f;const d=new Promise(h=>{o.subscribe(h),f=h}).then(s);return d.cancel=function(){o.unsubscribe(f)},d},r(function(f,d,h){o.reason||(o.reason=new Zl(f,d,h),i(o.reason))})}throwIfRequested(){if(this.reason)throw this.reason}subscribe(r){if(this.reason){r(this.reason);return}this._listeners?this._listeners.push(r):this._listeners=[r]}unsubscribe(r){if(!this._listeners)return;const i=this._listeners.indexOf(r);i!==-1&&this._listeners.splice(i,1)}toAbortSignal(){const r=new AbortController,i=o=>{r.abort(o)};return this.subscribe(i),r.signal.unsubscribe=()=>this.unsubscribe(i),r.signal}static source(){let r;return{token:new Nv(function(s){r=s}),cancel:r}}};function yA(l){return function(i){return l.apply(null,i)}}function vA(l){return j.isObject(l)&&l.isAxiosError===!0}const ls={Continue:100,SwitchingProtocols:101,Processing:102,EarlyHints:103,Ok:200,Created:201,Accepted:202,NonAuthoritativeInformation:203,NoContent:204,ResetContent:205,PartialContent:206,MultiStatus:207,AlreadyReported:208,ImUsed:226,MultipleChoices:300,MovedPermanently:301,Found:302,SeeOther:303,NotModified:304,UseProxy:305,Unused:306,TemporaryRedirect:307,PermanentRedirect:308,BadRequest:400,Unauthorized:401,PaymentRequired:402,Forbidden:403,NotFound:404,MethodNotAllowed:405,NotAcceptable:406,ProxyAuthenticationRequired:407,RequestTimeout:408,Conflict:409,Gone:410,LengthRequired:411,PreconditionFailed:412,PayloadTooLarge:413,UriTooLong:414,UnsupportedMediaType:415,RangeNotSatisfiable:416,ExpectationFailed:417,ImATeapot:418,MisdirectedRequest:421,UnprocessableEntity:422,Locked:423,FailedDependency:424,TooEarly:425,UpgradeRequired:426,PreconditionRequired:428,TooManyRequests:429,RequestHeaderFieldsTooLarge:431,UnavailableForLegalReasons:451,InternalServerError:500,NotImplemented:501,BadGateway:502,ServiceUnavailable:503,GatewayTimeout:504,HttpVersionNotSupported:505,VariantAlsoNegotiates:506,InsufficientStorage:507,LoopDetected:508,NotExtended:510,NetworkAuthenticationRequired:511,WebServerIsDown:521,ConnectionTimedOut:522,OriginIsUnreachable:523,TimeoutOccurred:524,SslHandshakeFailed:525,InvalidSslCertificate:526};Object.entries(ls).forEach(([l,r])=>{ls[r]=l});function qm(l){const r=new fl(l),i=em(fl.prototype.request,r);return j.extend(i,fl.prototype,r,{allOwnKeys:!0}),j.extend(i,r,null,{allOwnKeys:!0}),i.create=function(s){return qm(cl(l,s))},i}const Be=qm(Xa);Be.Axios=fl,Be.CanceledError=Zl,Be.CancelToken=gA,Be.isCancel=Em,Be.VERSION=Hm,Be.toFormData=Ai,Be.AxiosError=fe,Be.Cancel=Be.CanceledError,Be.all=function(r){return Promise.all(r)},Be.spread=yA,Be.isAxiosError=vA,Be.mergeConfig=cl,Be.AxiosHeaders=dt,Be.formToJSON=l=>bm(j.isHTMLForm(l)?new FormData(l):l),Be.getAdapter=Lm.getAdapter,Be.HttpStatusCode=ls,Be.default=Be;const{Axios:iO,AxiosError:oO,CanceledError:uO,isCancel:sO,CancelToken:cO,VERSION:fO,all:dO,Cancel:hO,isAxiosError:mO,spread:pO,toFormData:gO,AxiosHeaders:yO,HttpStatusCode:vO,formToJSON:bO,getAdapter:SO,mergeConfig:EO}=Be;function bA({className:l,...r}){return L.jsx(CS,{role:"status","aria-label":"Loading",className:_t("size-4 animate-spin",l),...r})}function SA({apiUrl:l,productId:r,imageUrl:i}){console.log("0.1.3");const[o,s]=S.useState(),[f,d]=S.useState(),[h,g]=S.useState(!1),[p,v]=S.useState(!1),b=S.useRef(null),T=async x=>await $x(x,{cacheBust:!0,pixelRatio:1,skipFonts:!1}),C=async()=>{if(b.current){g(!0),v(!0),await Nb(100);try{const x=await T(b.current),{data:O}=await Be.post(l,{productId:r,image:x});console.log(O),await Be.post("/cart/add.json",{items:[{id:O.id,quantity:1}]}),window.location.href="/cart"}catch(x){window.alert("Error while cropping or adding product to cart. Contact our manager."),console.error("Error while cropping or adding product to cart. Contact our manager."),console.error(x)}finally{g(!1),v(!1)}}},w=L.jsxs(ou,{onClick:C,disabled:h,children:[h&&L.jsx(bA,{})," Add to cart"]});return L.jsx(L.Fragment,{children:L.jsx(ex,{actionButton:w,heightValue:f,widthValue:o,onHeightChange:d,onWidthChange:s,children:L.jsxs("div",{className:"flex justify-center",children:[L.jsx("img",{className:"object-cover max-h-[70vh] border-2 border-dashed border-black",src:i,ref:b,style:{aspectRatio:`${o??"50"} / ${f??"50"}`,pointerEvents:"none",display:p?"block":"none"}}),L.jsx(tx,{width:o,height:f,imageUrl:i,generatingImg:p})]})})})}function EA(l,r){const i=typeof l=="string"?document.querySelector(l):l;Yv.createRoot(i).render(L.jsx(SA,{...r}))}return Qo.mountConstructorWidget=EA,Object.defineProperty(Qo,Symbol.toStringTag,{value:"Module"}),Qo}({});
|