picture-designer 0.1.0 → 0.1.1
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.
|
@@ -19809,7 +19809,8 @@ function uO({ apiUrl: a, productId: r, imageUrl: i }) {
|
|
|
19809
19809
|
/* @__PURE__ */ G.jsx("div", { className: "flex justify-center", children: /* @__PURE__ */ G.jsx(HA, { width: o, height: f, imageUrl: i }) }),
|
|
19810
19810
|
/* @__PURE__ */ G.jsx("img", { className: "fixed object-cover", src: i, ref: h, style: {
|
|
19811
19811
|
aspectRatio: `${o} / ${f}`,
|
|
19812
|
-
top: "-
|
|
19812
|
+
top: "-9999px",
|
|
19813
|
+
left: "-9999px"
|
|
19813
19814
|
} })
|
|
19814
19815
|
]
|
|
19815
19816
|
}
|
|
@@ -155,4 +155,4 @@ For more information, see https://radix-ui.com/primitives/docs/components/${r.do
|
|
|
155
155
|
`)}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[Hm]=this[Hm]={accessors:{}}).accessors,s=this.prototype;function f(d){const m=ur(d);o[m]||(mA(s,d),o[m]=!0)}return B.isArray(r)?r.forEach(f):f(r),this}};Tt.accessor(["Content-Type","Content-Length","Accept","Accept-Encoding","User-Agent","Authorization"]),B.reduceDescriptors(Tt.prototype,({value:a},r)=>{let i=r[0].toUpperCase()+r.slice(1);return{get:()=>a,set(o){this[i]=o}}}),B.freezeMethods(Tt);function ys(a,r){const i=this||or,o=r||i,s=Tt.from(o.headers);let f=o.data;return B.forEach(a,function(m){f=m.call(i,f,s.normalize(),r?r.status:void 0)}),s.normalize(),f}function km(a){return!!(a&&a.__CANCEL__)}function sl(a,r,i){xe.call(this,a??"canceled",xe.ERR_CANCELED,r,i),this.name="CanceledError"}B.inherits(sl,xe,{__CANCEL__:!0});function Bm(a,r,i){const o=i.config.validateStatus;!i.status||!o||o(i.status)?a(i):r(new xe("Request failed with status code "+i.status,[xe.ERR_BAD_REQUEST,xe.ERR_BAD_RESPONSE][Math.floor(i.status/100)-4],i.config,i.request,i))}function pA(a){const r=/^([-+\w]{1,25})(:?\/\/|:)/.exec(a);return r&&r[1]||""}function gA(a,r){a=a||10;const i=new Array(a),o=new Array(a);let s=0,f=0,d;return r=r!==void 0?r:1e3,function(g){const h=Date.now(),y=o[f];d||(d=h),i[s]=g,o[s]=h;let b=f,A=0;for(;b!==s;)A+=i[b++],b=b%a;if(s=(s+1)%a,s===f&&(f=(f+1)%a),h-d<r)return;const _=y&&h-y;return _?Math.round(A*1e3/_):void 0}}function yA(a,r){let i=0,o=1e3/r,s,f;const d=(h,y=Date.now())=>{i=y,s=null,f&&(clearTimeout(f),f=null),a(...h)};return[(...h)=>{const y=Date.now(),b=y-i;b>=o?d(h,y):(s=h,f||(f=setTimeout(()=>{f=null,d(s)},o-b)))},()=>s&&d(s)]}const Qi=(a,r,i=3)=>{let o=0;const s=gA(50,250);return yA(f=>{const d=f.loaded,m=f.lengthComputable?f.total:void 0,g=d-o,h=s(g),y=d<=m;o=d;const b={loaded:d,total:m,progress:m?d/m:void 0,bytes:g,rate:h||void 0,estimated:h&&m&&y?(m-d)/h:void 0,event:f,lengthComputable:m!=null,[r?"download":"upload"]:!0};a(b)},i)},qm=(a,r)=>{const i=a!=null;return[o=>r[0]({lengthComputable:i,total:a,loaded:o}),r[1]]},Vm=a=>(...r)=>B.asap(()=>a(...r)),vA=yt.hasStandardBrowserEnv?((a,r)=>i=>(i=new URL(i,yt.origin),a.protocol===i.protocol&&a.host===i.host&&(r||a.port===i.port)))(new URL(yt.origin),yt.navigator&&/(msie|trident)/i.test(yt.navigator.userAgent)):()=>!0,bA=yt.hasStandardBrowserEnv?{write(a,r,i,o,s,f,d){if(typeof document>"u")return;const m=[`${a}=${encodeURIComponent(r)}`];B.isNumber(i)&&m.push(`expires=${new Date(i).toUTCString()}`),B.isString(o)&&m.push(`path=${o}`),B.isString(s)&&m.push(`domain=${s}`),f===!0&&m.push("secure"),B.isString(d)&&m.push(`SameSite=${d}`),document.cookie=m.join("; ")},read(a){if(typeof document>"u")return null;const r=document.cookie.match(new RegExp("(?:^|; )"+a+"=([^;]*)"));return r?decodeURIComponent(r[1]):null},remove(a){this.write(a,"",Date.now()-864e5,"/")}}:{write(){},read(){return null},remove(){}};function SA(a){return/^([a-z][a-z\d+\-.]*:)?\/\//i.test(a)}function EA(a,r){return r?a.replace(/\/?\/$/,"")+"/"+r.replace(/^\/+/,""):a}function Gm(a,r,i){let o=!SA(r);return a&&(o||i==!1)?EA(a,r):r}const Ym=a=>a instanceof Tt?{...a}:a;function Aa(a,r){r=r||{};const i={};function o(h,y,b,A){return B.isPlainObject(h)&&B.isPlainObject(y)?B.merge.call({caseless:A},h,y):B.isPlainObject(y)?B.merge({},y):B.isArray(y)?y.slice():y}function s(h,y,b,A){if(B.isUndefined(y)){if(!B.isUndefined(h))return o(void 0,h,b,A)}else return o(h,y,b,A)}function f(h,y){if(!B.isUndefined(y))return o(void 0,y)}function d(h,y){if(B.isUndefined(y)){if(!B.isUndefined(h))return o(void 0,h)}else return o(void 0,y)}function m(h,y,b){if(b in r)return o(h,y);if(b in a)return o(void 0,h)}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:m,headers:(h,y,b)=>s(Ym(h),Ym(y),b,!0)};return B.forEach(Object.keys({...a,...r}),function(y){const b=g[y]||s,A=b(a[y],r[y],y);B.isUndefined(A)&&b!==m||(i[y]=A)}),i}const Xm=a=>{const r=Aa({},a);let{data:i,withXSRFToken:o,xsrfHeaderName:s,xsrfCookieName:f,headers:d,auth:m}=r;if(r.headers=d=Tt.from(d),r.url=zm(Gm(r.baseURL,r.url,r.allowAbsoluteUrls),a.params,a.paramsSerializer),m&&d.set("Authorization","Basic "+btoa((m.username||"")+":"+(m.password?unescape(encodeURIComponent(m.password)):""))),B.isFormData(i)){if(yt.hasStandardBrowserEnv||yt.hasStandardBrowserWebWorkerEnv)d.setContentType(void 0);else if(B.isFunction(i.getHeaders)){const g=i.getHeaders(),h=["content-type","content-length"];Object.entries(g).forEach(([y,b])=>{h.includes(y.toLowerCase())&&d.set(y,b)})}}if(yt.hasStandardBrowserEnv&&(o&&B.isFunction(o)&&(o=o(r)),o||o!==!1&&vA(r.url))){const g=s&&f&&bA.read(f);g&&d.set(s,g)}return r},xA=typeof XMLHttpRequest<"u"&&function(a){return new Promise(function(i,o){const s=Xm(a);let f=s.data;const d=Tt.from(s.headers).normalize();let{responseType:m,onUploadProgress:g,onDownloadProgress:h}=s,y,b,A,_,R;function T(){_&&_(),R&&R(),s.cancelToken&&s.cancelToken.unsubscribe(y),s.signal&&s.signal.removeEventListener("abort",y)}let D=new XMLHttpRequest;D.open(s.method.toUpperCase(),s.url,!0),D.timeout=s.timeout;function Y(){if(!D)return;const $=Tt.from("getAllResponseHeaders"in D&&D.getAllResponseHeaders()),ee={data:!m||m==="text"||m==="json"?D.responseText:D.response,status:D.status,statusText:D.statusText,headers:$,config:a,request:D};Bm(function(X){i(X),T()},function(X){o(X),T()},ee),D=null}"onloadend"in D?D.onloadend=Y:D.onreadystatechange=function(){!D||D.readyState!==4||D.status===0&&!(D.responseURL&&D.responseURL.indexOf("file:")===0)||setTimeout(Y)},D.onabort=function(){D&&(o(new xe("Request aborted",xe.ECONNABORTED,a,D)),D=null)},D.onerror=function(F){const ee=F&&F.message?F.message:"Network Error",I=new xe(ee,xe.ERR_NETWORK,a,D);I.event=F||null,o(I),D=null},D.ontimeout=function(){let F=s.timeout?"timeout of "+s.timeout+"ms exceeded":"timeout exceeded";const ee=s.transitional||Lm;s.timeoutErrorMessage&&(F=s.timeoutErrorMessage),o(new xe(F,ee.clarifyTimeoutError?xe.ETIMEDOUT:xe.ECONNABORTED,a,D)),D=null},f===void 0&&d.setContentType(null),"setRequestHeader"in D&&B.forEach(d.toJSON(),function(F,ee){D.setRequestHeader(ee,F)}),B.isUndefined(s.withCredentials)||(D.withCredentials=!!s.withCredentials),m&&m!=="json"&&(D.responseType=s.responseType),h&&([A,R]=Qi(h,!0),D.addEventListener("progress",A)),g&&D.upload&&([b,_]=Qi(g),D.upload.addEventListener("progress",b),D.upload.addEventListener("loadend",_)),(s.cancelToken||s.signal)&&(y=$=>{D&&(o(!$||$.type?new sl(null,a,D):$),D.abort(),D=null)},s.cancelToken&&s.cancelToken.subscribe(y),s.signal&&(s.signal.aborted?y():s.signal.addEventListener("abort",y)));const W=pA(s.url);if(W&&yt.protocols.indexOf(W)===-1){o(new xe("Unsupported protocol "+W+":",xe.ERR_BAD_REQUEST,a));return}D.send(f||null)})},wA=(a,r)=>{const{length:i}=a=a?a.filter(Boolean):[];if(r||i){let o=new AbortController,s;const f=function(h){if(!s){s=!0,m();const y=h instanceof Error?h:this.reason;o.abort(y instanceof xe?y:new sl(y instanceof Error?y.message:y))}};let d=r&&setTimeout(()=>{d=null,f(new xe(`timeout ${r} of ms exceeded`,xe.ETIMEDOUT))},r);const m=()=>{a&&(d&&clearTimeout(d),d=null,a.forEach(h=>{h.unsubscribe?h.unsubscribe(f):h.removeEventListener("abort",f)}),a=null)};a.forEach(h=>h.addEventListener("abort",f));const{signal:g}=o;return g.unsubscribe=()=>B.asap(m),g}},AA=function*(a,r){let i=a.byteLength;if(i<r){yield a;return}let o=0,s;for(;o<i;)s=o+r,yield a.slice(o,s),o=s},RA=async function*(a,r){for await(const i of TA(a))yield*AA(i,r)},TA=async function*(a){if(a[Symbol.asyncIterator]){yield*a;return}const r=a.getReader();try{for(;;){const{done:i,value:o}=await r.read();if(i)break;yield o}}finally{await r.cancel()}},Qm=(a,r,i,o)=>{const s=RA(a,r);let f=0,d,m=g=>{d||(d=!0,o&&o(g))};return new ReadableStream({async pull(g){try{const{done:h,value:y}=await s.next();if(h){m(),g.close();return}let b=y.byteLength;if(i){let A=f+=b;i(A)}g.enqueue(new Uint8Array(y))}catch(h){throw m(h),h}},cancel(g){return m(g),s.return()}},{highWaterMark:2})},Zm=64*1024,{isFunction:Zi}=B,OA=(({Request:a,Response:r})=>({Request:a,Response:r}))(B.global),{ReadableStream:Pm,TextEncoder:Km}=B.global,Fm=(a,...r)=>{try{return!!a(...r)}catch{return!1}},_A=a=>{a=B.merge.call({skipUndefined:!0},OA,a);const{fetch:r,Request:i,Response:o}=a,s=r?Zi(r):typeof fetch=="function",f=Zi(i),d=Zi(o);if(!s)return!1;const m=s&&Zi(Pm),g=s&&(typeof Km=="function"?(R=>T=>R.encode(T))(new Km):async R=>new Uint8Array(await new i(R).arrayBuffer())),h=f&&m&&Fm(()=>{let R=!1;const T=new i(yt.origin,{body:new Pm,method:"POST",get duplex(){return R=!0,"half"}}).headers.has("Content-Type");return R&&!T}),y=d&&m&&Fm(()=>B.isReadableStream(new o("").body)),b={stream:y&&(R=>R.body)};s&&["text","arrayBuffer","blob","formData","stream"].forEach(R=>{!b[R]&&(b[R]=(T,D)=>{let Y=T&&T[R];if(Y)return Y.call(T);throw new xe(`Response type '${R}' is not supported`,xe.ERR_NOT_SUPPORT,D)})});const A=async R=>{if(R==null)return 0;if(B.isBlob(R))return R.size;if(B.isSpecCompliantForm(R))return(await new i(yt.origin,{method:"POST",body:R}).arrayBuffer()).byteLength;if(B.isArrayBufferView(R)||B.isArrayBuffer(R))return R.byteLength;if(B.isURLSearchParams(R)&&(R=R+""),B.isString(R))return(await g(R)).byteLength},_=async(R,T)=>{const D=B.toFiniteNumber(R.getContentLength());return D??A(T)};return async R=>{let{url:T,method:D,data:Y,signal:W,cancelToken:$,timeout:F,onDownloadProgress:ee,onUploadProgress:I,responseType:X,headers:E,withCredentials:O="same-origin",fetchOptions:q}=Xm(R),ae=r||fetch;X=X?(X+"").toLowerCase():"text";let te=wA([W,$&&$.toAbortSignal()],F),re=null;const fe=te&&te.unsubscribe&&(()=>{te.unsubscribe()});let Ee;try{if(I&&h&&D!=="get"&&D!=="head"&&(Ee=await _(E,Y))!==0){let x=new i(T,{method:"POST",body:Y,duplex:"half"}),H;if(B.isFormData(Y)&&(H=x.headers.get("content-type"))&&E.setContentType(H),x.body){const[V,P]=qm(Ee,Qi(Vm(I)));Y=Qm(x.body,Zm,V,P)}}B.isString(O)||(O=O?"include":"omit");const Q=f&&"credentials"in i.prototype,L={...q,signal:te,method:D.toUpperCase(),headers:E.normalize().toJSON(),body:Y,duplex:"half",credentials:Q?O:void 0};re=f&&new i(T,L);let M=await(f?ae(re,q):ae(T,L));const ne=y&&(X==="stream"||X==="response");if(y&&(ee||ne&&fe)){const x={};["status","statusText","headers"].forEach(ie=>{x[ie]=M[ie]});const H=B.toFiniteNumber(M.headers.get("content-length")),[V,P]=ee&&qm(H,Qi(Vm(ee),!0))||[];M=new o(Qm(M.body,Zm,V,()=>{P&&P(),fe&&fe()}),x)}X=X||"text";let de=await b[B.findKey(b,X)||"text"](M,R);return!ne&&fe&&fe(),await new Promise((x,H)=>{Bm(x,H,{data:de,headers:Tt.from(M.headers),status:M.status,statusText:M.statusText,config:R,request:re})})}catch(Q){throw fe&&fe(),Q&&Q.name==="TypeError"&&/Load failed|fetch/i.test(Q.message)?Object.assign(new xe("Network Error",xe.ERR_NETWORK,R,re),{cause:Q.cause||Q}):xe.from(Q,Q&&Q.code,R,re)}}},CA=new Map,$m=a=>{let r=a&&a.env||{};const{fetch:i,Request:o,Response:s}=r,f=[o,s,i];let d=f.length,m=d,g,h,y=CA;for(;m--;)g=f[m],h=y.get(g),h===void 0&&y.set(g,h=m?new Map:_A(r)),y=h;return h};$m();const vs={http:Jw,xhr:xA,fetch:{get:$m}};B.forEach(vs,(a,r)=>{if(a){try{Object.defineProperty(a,"name",{value:r})}catch{}Object.defineProperty(a,"adapterName",{value:r})}});const Jm=a=>`- ${a}`,DA=a=>B.isFunction(a)||a===null||a===!1;function MA(a,r){a=B.isArray(a)?a:[a];const{length:i}=a;let o,s;const f={};for(let d=0;d<i;d++){o=a[d];let m;if(s=o,!DA(o)&&(s=vs[(m=String(o)).toLowerCase()],s===void 0))throw new xe(`Unknown adapter '${m}'`);if(s&&(B.isFunction(s)||(s=s.get(r))))break;f[m||"#"+d]=s}if(!s){const d=Object.entries(f).map(([g,h])=>`adapter ${g} `+(h===!1?"is not supported by the environment":"is not available in the build"));let m=i?d.length>1?`since :
|
|
156
156
|
`+d.map(Jm).join(`
|
|
157
157
|
`):" "+Jm(d[0]):"as no adapter specified";throw new xe("There is no suitable adapter to dispatch the request "+m,"ERR_NOT_SUPPORT")}return s}const Wm={getAdapter:MA,adapters:vs};function bs(a){if(a.cancelToken&&a.cancelToken.throwIfRequested(),a.signal&&a.signal.aborted)throw new sl(null,a)}function Im(a){return bs(a),a.headers=Tt.from(a.headers),a.data=ys.call(a,a.transformRequest),["post","put","patch"].indexOf(a.method)!==-1&&a.headers.setContentType("application/x-www-form-urlencoded",!1),Wm.getAdapter(a.adapter||or.adapter,a)(a).then(function(o){return bs(a),o.data=ys.call(a,a.transformResponse,o),o.headers=Tt.from(o.headers),o},function(o){return km(o)||(bs(a),o&&o.response&&(o.response.data=ys.call(a,a.transformResponse,o.response),o.response.headers=Tt.from(o.response.headers))),Promise.reject(o)})}const ep="1.13.2",Pi={};["object","boolean","number","function","string","symbol"].forEach((a,r)=>{Pi[a]=function(o){return typeof o===a||"a"+(r<1?"n ":" ")+a}});const tp={};Pi.transitional=function(r,i,o){function s(f,d){return"[Axios v"+ep+"] Transitional option '"+f+"'"+d+(o?". "+o:"")}return(f,d,m)=>{if(r===!1)throw new xe(s(d," has been removed"+(i?" in "+i:"")),xe.ERR_DEPRECATED);return i&&!tp[d]&&(tp[d]=!0,console.warn(s(d," has been deprecated since v"+i+" and will be removed in the near future"))),r?r(f,d,m):!0}},Pi.spelling=function(r){return(i,o)=>(console.warn(`${o} is likely a misspelling of ${r}`),!0)};function NA(a,r,i){if(typeof a!="object")throw new xe("options must be an object",xe.ERR_BAD_OPTION_VALUE);const o=Object.keys(a);let s=o.length;for(;s-- >0;){const f=o[s],d=r[f];if(d){const m=a[f],g=m===void 0||d(m,f,a);if(g!==!0)throw new xe("option "+f+" must be "+g,xe.ERR_BAD_OPTION_VALUE);continue}if(i!==!0)throw new xe("Unknown option "+f,xe.ERR_BAD_OPTION)}}const Ki={assertOptions:NA,validators:Pi},yn=Ki.validators;let Ra=class{constructor(r){this.defaults=r||{},this.interceptors={request:new Um,response:new Um}}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+=`
|
|
158
|
-
`+f):o.stack=f}catch{}}throw o}}_request(r,i){typeof r=="string"?(i=i||{},i.url=r):i=r||{},i=Aa(this.defaults,i);const{transitional:o,paramsSerializer:s,headers:f}=i;o!==void 0&&Ki.assertOptions(o,{silentJSONParsing:yn.transitional(yn.boolean),forcedJSONParsing:yn.transitional(yn.boolean),clarifyTimeoutError:yn.transitional(yn.boolean)},!1),s!=null&&(B.isFunction(s)?i.paramsSerializer={serialize:s}:Ki.assertOptions(s,{encode:yn.function,serialize:yn.function},!0)),i.allowAbsoluteUrls!==void 0||(this.defaults.allowAbsoluteUrls!==void 0?i.allowAbsoluteUrls=this.defaults.allowAbsoluteUrls:i.allowAbsoluteUrls=!0),Ki.assertOptions(i,{baseUrl:yn.spelling("baseURL"),withXsrfToken:yn.spelling("withXSRFToken")},!0),i.method=(i.method||this.defaults.method||"get").toLowerCase();let d=f&&B.merge(f.common,f[i.method]);f&&B.forEach(["delete","get","head","post","put","patch","common"],R=>{delete f[R]}),i.headers=Tt.concat(d,f);const m=[];let g=!0;this.interceptors.request.forEach(function(T){typeof T.runWhen=="function"&&T.runWhen(i)===!1||(g=g&&T.synchronous,m.unshift(T.fulfilled,T.rejected))});const h=[];this.interceptors.response.forEach(function(T){h.push(T.fulfilled,T.rejected)});let y,b=0,A;if(!g){const R=[Im.bind(this),void 0];for(R.unshift(...m),R.push(...h),A=R.length,y=Promise.resolve(i);b<A;)y=y.then(R[b++],R[b++]);return y}A=m.length;let _=i;for(;b<A;){const R=m[b++],T=m[b++];try{_=R(_)}catch(D){T.call(this,D);break}}try{y=Im.call(this,_)}catch(R){return Promise.reject(R)}for(b=0,A=h.length;b<A;)y=y.then(h[b++],h[b++]);return y}getUri(r){r=Aa(this.defaults,r);const i=Gm(r.baseURL,r.url,r.allowAbsoluteUrls);return zm(i,r.params,r.paramsSerializer)}};B.forEach(["delete","get","head","options"],function(r){Ra.prototype[r]=function(i,o){return this.request(Aa(o||{},{method:r,url:i,data:(o||{}).data}))}}),B.forEach(["post","put","patch"],function(r){function i(o){return function(f,d,m){return this.request(Aa(m||{},{method:r,headers:o?{"Content-Type":"multipart/form-data"}:{},url:f,data:d}))}}Ra.prototype[r]=i(),Ra.prototype[r+"Form"]=i(!0)});let zA=class Zv{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(m=>{o.subscribe(m),f=m}).then(s);return d.cancel=function(){o.unsubscribe(f)},d},r(function(f,d,m){o.reason||(o.reason=new sl(f,d,m),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 Zv(function(s){r=s}),cancel:r}}};function UA(a){return function(i){return a.apply(null,i)}}function LA(a){return B.isObject(a)&&a.isAxiosError===!0}const Ss={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(Ss).forEach(([a,r])=>{Ss[r]=a});function np(a){const r=new Ra(a),i=ym(Ra.prototype.request,r);return B.extend(i,Ra.prototype,r,{allOwnKeys:!0}),B.extend(i,r,null,{allOwnKeys:!0}),i.create=function(s){return np(Aa(a,s))},i}const Fe=np(or);Fe.Axios=Ra,Fe.CanceledError=sl,Fe.CancelToken=zA,Fe.isCancel=km,Fe.VERSION=ep,Fe.toFormData=Yi,Fe.AxiosError=xe,Fe.Cancel=Fe.CanceledError,Fe.all=function(r){return Promise.all(r)},Fe.spread=UA,Fe.isAxiosError=LA,Fe.mergeConfig=Aa,Fe.AxiosHeaders=Tt,Fe.formToJSON=a=>jm(B.isHTMLForm(a)?new FormData(a):a),Fe.getAdapter=Wm.getAdapter,Fe.HttpStatusCode=Ss,Fe.default=Fe;const{Axios:mO,AxiosError:pO,CanceledError:gO,isCancel:yO,CancelToken:vO,VERSION:bO,all:SO,Cancel:EO,isAxiosError:xO,spread:wO,toFormData:AO,AxiosHeaders:RO,HttpStatusCode:TO,formToJSON:OO,getAdapter:_O,mergeConfig:CO}=Fe;function jA({className:a,...r}){return G.jsx(QS,{role:"status","aria-label":"Loading",className:Yt("size-4 animate-spin",a),...r})}function HA({apiUrl:a,productId:r,imageUrl:i}){const[o,s]=S.useState(),[f,d]=S.useState(),[m,g]=S.useState(!1),h=S.useRef(null),y=async _=>await dw(_,{cacheBust:!0,pixelRatio:1,skipFonts:!1}),b=async()=>{if(h.current){g(!0);try{const _=await y(h.current),{data:R}=await Fe.post(a,{productId:r,image:_});console.log(R),await Fe.post("/cart/add.json",{items:[{id:R.id,quantity:1}]}),window.location.href="/cart"}catch(_){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(_)}finally{g(!1)}}},A=G.jsxs(Au,{onClick:b,disabled:m,children:[m&&G.jsx(jA,{})," Add to cart"]});return G.jsxs(yx,{actionButton:A,heightValue:f,widthValue:o,onHeightChange:d,onWidthChange:s,children:[G.jsx("div",{className:"flex justify-center",children:G.jsx(vx,{width:o,height:f,imageUrl:i})}),G.jsx("img",{className:"fixed object-cover",src:i,ref:h,style:{aspectRatio:`${o} / ${f}`,top:"-
|
|
158
|
+
`+f):o.stack=f}catch{}}throw o}}_request(r,i){typeof r=="string"?(i=i||{},i.url=r):i=r||{},i=Aa(this.defaults,i);const{transitional:o,paramsSerializer:s,headers:f}=i;o!==void 0&&Ki.assertOptions(o,{silentJSONParsing:yn.transitional(yn.boolean),forcedJSONParsing:yn.transitional(yn.boolean),clarifyTimeoutError:yn.transitional(yn.boolean)},!1),s!=null&&(B.isFunction(s)?i.paramsSerializer={serialize:s}:Ki.assertOptions(s,{encode:yn.function,serialize:yn.function},!0)),i.allowAbsoluteUrls!==void 0||(this.defaults.allowAbsoluteUrls!==void 0?i.allowAbsoluteUrls=this.defaults.allowAbsoluteUrls:i.allowAbsoluteUrls=!0),Ki.assertOptions(i,{baseUrl:yn.spelling("baseURL"),withXsrfToken:yn.spelling("withXSRFToken")},!0),i.method=(i.method||this.defaults.method||"get").toLowerCase();let d=f&&B.merge(f.common,f[i.method]);f&&B.forEach(["delete","get","head","post","put","patch","common"],R=>{delete f[R]}),i.headers=Tt.concat(d,f);const m=[];let g=!0;this.interceptors.request.forEach(function(T){typeof T.runWhen=="function"&&T.runWhen(i)===!1||(g=g&&T.synchronous,m.unshift(T.fulfilled,T.rejected))});const h=[];this.interceptors.response.forEach(function(T){h.push(T.fulfilled,T.rejected)});let y,b=0,A;if(!g){const R=[Im.bind(this),void 0];for(R.unshift(...m),R.push(...h),A=R.length,y=Promise.resolve(i);b<A;)y=y.then(R[b++],R[b++]);return y}A=m.length;let _=i;for(;b<A;){const R=m[b++],T=m[b++];try{_=R(_)}catch(D){T.call(this,D);break}}try{y=Im.call(this,_)}catch(R){return Promise.reject(R)}for(b=0,A=h.length;b<A;)y=y.then(h[b++],h[b++]);return y}getUri(r){r=Aa(this.defaults,r);const i=Gm(r.baseURL,r.url,r.allowAbsoluteUrls);return zm(i,r.params,r.paramsSerializer)}};B.forEach(["delete","get","head","options"],function(r){Ra.prototype[r]=function(i,o){return this.request(Aa(o||{},{method:r,url:i,data:(o||{}).data}))}}),B.forEach(["post","put","patch"],function(r){function i(o){return function(f,d,m){return this.request(Aa(m||{},{method:r,headers:o?{"Content-Type":"multipart/form-data"}:{},url:f,data:d}))}}Ra.prototype[r]=i(),Ra.prototype[r+"Form"]=i(!0)});let zA=class Zv{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(m=>{o.subscribe(m),f=m}).then(s);return d.cancel=function(){o.unsubscribe(f)},d},r(function(f,d,m){o.reason||(o.reason=new sl(f,d,m),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 Zv(function(s){r=s}),cancel:r}}};function UA(a){return function(i){return a.apply(null,i)}}function LA(a){return B.isObject(a)&&a.isAxiosError===!0}const Ss={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(Ss).forEach(([a,r])=>{Ss[r]=a});function np(a){const r=new Ra(a),i=ym(Ra.prototype.request,r);return B.extend(i,Ra.prototype,r,{allOwnKeys:!0}),B.extend(i,r,null,{allOwnKeys:!0}),i.create=function(s){return np(Aa(a,s))},i}const Fe=np(or);Fe.Axios=Ra,Fe.CanceledError=sl,Fe.CancelToken=zA,Fe.isCancel=km,Fe.VERSION=ep,Fe.toFormData=Yi,Fe.AxiosError=xe,Fe.Cancel=Fe.CanceledError,Fe.all=function(r){return Promise.all(r)},Fe.spread=UA,Fe.isAxiosError=LA,Fe.mergeConfig=Aa,Fe.AxiosHeaders=Tt,Fe.formToJSON=a=>jm(B.isHTMLForm(a)?new FormData(a):a),Fe.getAdapter=Wm.getAdapter,Fe.HttpStatusCode=Ss,Fe.default=Fe;const{Axios:mO,AxiosError:pO,CanceledError:gO,isCancel:yO,CancelToken:vO,VERSION:bO,all:SO,Cancel:EO,isAxiosError:xO,spread:wO,toFormData:AO,AxiosHeaders:RO,HttpStatusCode:TO,formToJSON:OO,getAdapter:_O,mergeConfig:CO}=Fe;function jA({className:a,...r}){return G.jsx(QS,{role:"status","aria-label":"Loading",className:Yt("size-4 animate-spin",a),...r})}function HA({apiUrl:a,productId:r,imageUrl:i}){const[o,s]=S.useState(),[f,d]=S.useState(),[m,g]=S.useState(!1),h=S.useRef(null),y=async _=>await dw(_,{cacheBust:!0,pixelRatio:1,skipFonts:!1}),b=async()=>{if(h.current){g(!0);try{const _=await y(h.current),{data:R}=await Fe.post(a,{productId:r,image:_});console.log(R),await Fe.post("/cart/add.json",{items:[{id:R.id,quantity:1}]}),window.location.href="/cart"}catch(_){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(_)}finally{g(!1)}}},A=G.jsxs(Au,{onClick:b,disabled:m,children:[m&&G.jsx(jA,{})," Add to cart"]});return G.jsxs(yx,{actionButton:A,heightValue:f,widthValue:o,onHeightChange:d,onWidthChange:s,children:[G.jsx("div",{className:"flex justify-center",children:G.jsx(vx,{width:o,height:f,imageUrl:i})}),G.jsx("img",{className:"fixed object-cover",src:i,ref:h,style:{aspectRatio:`${o} / ${f}`,top:"-9999px",left:"-9999px"}})]})}function kA(a,r){const i=typeof a=="string"?document.querySelector(a):a;ab.createRoot(i).render(G.jsx(HA,{...r}))}return uu.mountConstructorWidget=kA,Object.defineProperty(uu,Symbol.toStringTag,{value:"Module"}),uu}({});
|