New Case Study:See how Anthropic automated 95% of dependency reviews with Socket.Learn More
Socket
Sign inDemoInstall
Socket

@printcart/wix-integration

Package Overview
Dependencies
Maintainers
0
Versions
19
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

@printcart/wix-integration - npm Package Compare versions

Comparing version 1.1.12 to 1.1.13

12

dist/main.es.js

@@ -730,3 +730,4 @@ var __defProp = Object.defineProperty;

}
const handleClick = () => {
const handleClick = (e) => {
e.preventDefault();
if (__privateGet(this, _designerInstance) && !__privateGet(this, _uploaderInstance)) {

@@ -871,3 +872,4 @@ __privateGet(this, _designerInstance).render();

btn.innerHTML = ((_a2 = this.options) == null ? void 0 : _a2.removeUploaderBtnText) ? this.options.removeUploaderBtnText : "Remove";
btn.onclick = () => {
btn.onclick = (e) => {
e.preventDefault();
const newIds = input.value.split(",").filter((id) => id !== design.data.id);

@@ -932,3 +934,4 @@ input.value = newIds.join();

editBtn.innerHTML = "Edit";
editBtn.onclick = () => {
editBtn.onclick = (e) => {
e.preventDefault();
__privateGet(self, _designerInstance).editDesign(design.id);

@@ -940,3 +943,4 @@ };

removeBtn.innerHTML = "Remove";
removeBtn.onclick = () => {
removeBtn.onclick = (e) => {
e.preventDefault();
const newIds = input.value.split(",").filter((id) => id !== design.id);

@@ -943,0 +947,0 @@ input.value = newIds.join();

@@ -1,1 +0,1 @@

var At=Object.defineProperty;var Ht=(g,w,I)=>w in g?At(g,w,{enumerable:!0,configurable:!0,writable:!0,value:I}):g[w]=I;var B=(g,w,I)=>(Ht(g,typeof w!="symbol"?w+"":w,I),I),Ne=(g,w,I)=>{if(!w.has(g))throw TypeError("Cannot "+I)};var u=(g,w,I)=>(Ne(g,w,"read from private field"),I?I.call(g):w.get(g)),E=(g,w,I)=>{if(w.has(g))throw TypeError("Cannot add the same private member more than once");w instanceof WeakSet?w.add(g):w.set(g,I)},q=(g,w,I,le)=>(Ne(g,w,"write to private field"),le?le.call(g,I):w.set(g,I),I);var y=(g,w,I)=>(Ne(g,w,"access private method"),I);(function(g){typeof define=="function"&&define.amd?define(g):g()})(function(){var $,Q,C,P,j,ee,Re,te,Be,de,lt,pe,dt,R,G,ue,pt,he,ut,fe,ht,me,ft,ve,mt,ge,vt,ye,gt,we,yt,be,wt,_e,bt,Ee,_t,Le,Et;"use strict";const g=function(){var Ae=Object.defineProperty,c=(e,t,n)=>t in e?Ae(e,t,{enumerable:!0,configurable:!0,writable:!0,value:n}):e[t]=n,o=(e,t,n)=>(c(e,typeof t!="symbol"?t+"":t,n),n),a=Object.defineProperty,d=(e,t,n)=>t in e?a(e,t,{enumerable:!0,configurable:!0,writable:!0,value:n}):e[t]=n,p=(e,t,n)=>(d(e,typeof t!="symbol"?t+"":t,n),n),v=(e,t,n)=>{if(!t.has(e))throw TypeError("Cannot "+n)},L=(e,t,n)=>(v(e,t,"read from private field"),n?n.call(e):t.get(e)),b=(e,t,n)=>{if(t.has(e))throw TypeError("Cannot add the same private member more than once");t instanceof WeakSet?t.add(e):t.set(e,n)},k=(e,t,n,i)=>(v(e,t,"write to private field"),i?i.call(e,n):t.set(e,n),n),h=(e,t,n)=>(v(e,t,"access private method"),n),x,S,M,W,O,A,z,ne,U,D,Te={exports:{}},K=typeof Reflect=="object"?Reflect:null,He=K&&typeof K.apply=="function"?K.apply:function(e,t,n){return Function.prototype.apply.call(e,t,n)},Ie;K&&typeof K.ownKeys=="function"?Ie=K.ownKeys:Object.getOwnPropertySymbols?Ie=function(e){return Object.getOwnPropertyNames(e).concat(Object.getOwnPropertySymbols(e))}:Ie=function(e){return Object.getOwnPropertyNames(e)};function Lt(e){console&&console.warn&&console.warn(e)}var Fe=Number.isNaN||function(e){return e!==e};function f(){f.init.call(this)}Te.exports=f,Te.exports.once=xt,f.EventEmitter=f,f.prototype._events=void 0,f.prototype._eventsCount=0,f.prototype._maxListeners=void 0;var qe=10;function Ce(e){if(typeof e!="function")throw new TypeError('The "listener" argument must be of type Function. Received type '+typeof e)}Object.defineProperty(f,"defaultMaxListeners",{enumerable:!0,get:function(){return qe},set:function(e){if(typeof e!="number"||e<0||Fe(e))throw new RangeError('The value of "defaultMaxListeners" is out of range. It must be a non-negative number. Received '+e+".");qe=e}}),f.init=function(){(this._events===void 0||this._events===Object.getPrototypeOf(this)._events)&&(this._events=Object.create(null),this._eventsCount=0),this._maxListeners=this._maxListeners||void 0},f.prototype.setMaxListeners=function(e){if(typeof e!="number"||e<0||Fe(e))throw new RangeError('The value of "n" is out of range. It must be a non-negative number. Received '+e+".");return this._maxListeners=e,this};function $e(e){return e._maxListeners===void 0?f.defaultMaxListeners:e._maxListeners}f.prototype.getMaxListeners=function(){return $e(this)},f.prototype.emit=function(e){for(var t=[],n=1;n<arguments.length;n++)t.push(arguments[n]);var i=e==="error",r=this._events;if(r!==void 0)i=i&&r.error===void 0;else if(!i)return!1;if(i){var s;if(t.length>0&&(s=t[0]),s instanceof Error)throw s;var l=new Error("Unhandled error."+(s?" ("+s.message+")":""));throw l.context=s,l}var _=r[e];if(_===void 0)return!1;if(typeof _=="function")He(_,this,t);else for(var ae=_.length,De=Ve(_,ae),n=0;n<ae;++n)He(De[n],this,t);return!0};function ze(e,t,n,i){var r,s,l;if(Ce(n),s=e._events,s===void 0?(s=e._events=Object.create(null),e._eventsCount=0):(s.newListener!==void 0&&(e.emit("newListener",t,n.listener?n.listener:n),s=e._events),l=s[t]),l===void 0)l=s[t]=n,++e._eventsCount;else if(typeof l=="function"?l=s[t]=i?[n,l]:[l,n]:i?l.unshift(n):l.push(n),r=$e(e),r>0&&l.length>r&&!l.warned){l.warned=!0;var _=new Error("Possible EventEmitter memory leak detected. "+l.length+" "+String(t)+" listeners added. Use emitter.setMaxListeners() to increase limit");_.name="MaxListenersExceededWarning",_.emitter=e,_.type=t,_.count=l.length,Lt(_)}return e}f.prototype.addListener=function(e,t){return ze(this,e,t,!1)},f.prototype.on=f.prototype.addListener,f.prototype.prependListener=function(e,t){return ze(this,e,t,!0)};function It(){if(!this.fired)return this.target.removeListener(this.type,this.wrapFn),this.fired=!0,arguments.length===0?this.listener.call(this.target):this.listener.apply(this.target,arguments)}function Ke(e,t,n){var i={fired:!1,wrapFn:void 0,target:e,type:t,listener:n},r=It.bind(i);return r.listener=n,i.wrapFn=r,r}f.prototype.once=function(e,t){return Ce(t),this.on(e,Ke(this,e,t)),this},f.prototype.prependOnceListener=function(e,t){return Ce(t),this.prependListener(e,Ke(this,e,t)),this},f.prototype.removeListener=function(e,t){var n,i,r,s,l;if(Ce(t),i=this._events,i===void 0)return this;if(n=i[e],n===void 0)return this;if(n===t||n.listener===t)--this._eventsCount===0?this._events=Object.create(null):(delete i[e],i.removeListener&&this.emit("removeListener",e,n.listener||t));else if(typeof n!="function"){for(r=-1,s=n.length-1;s>=0;s--)if(n[s]===t||n[s].listener===t){l=n[s].listener,r=s;break}if(r<0)return this;r===0?n.shift():Ct(n,r),n.length===1&&(i[e]=n[0]),i.removeListener!==void 0&&this.emit("removeListener",e,l||t)}return this},f.prototype.off=f.prototype.removeListener,f.prototype.removeAllListeners=function(e){var t,n,i;if(n=this._events,n===void 0)return this;if(n.removeListener===void 0)return arguments.length===0?(this._events=Object.create(null),this._eventsCount=0):n[e]!==void 0&&(--this._eventsCount===0?this._events=Object.create(null):delete n[e]),this;if(arguments.length===0){var r=Object.keys(n),s;for(i=0;i<r.length;++i)s=r[i],s!=="removeListener"&&this.removeAllListeners(s);return this.removeAllListeners("removeListener"),this._events=Object.create(null),this._eventsCount=0,this}if(t=n[e],typeof t=="function")this.removeListener(e,t);else if(t!==void 0)for(i=t.length-1;i>=0;i--)this.removeListener(e,t[i]);return this};function Xe(e,t,n){var i=e._events;if(i===void 0)return[];var r=i[t];return r===void 0?[]:typeof r=="function"?n?[r.listener||r]:[r]:n?kt(r):Ve(r,r.length)}f.prototype.listeners=function(e){return Xe(this,e,!0)},f.prototype.rawListeners=function(e){return Xe(this,e,!1)},f.listenerCount=function(e,t){return typeof e.listenerCount=="function"?e.listenerCount(t):Je.call(e,t)},f.prototype.listenerCount=Je;function Je(e){var t=this._events;if(t!==void 0){var n=t[e];if(typeof n=="function")return 1;if(n!==void 0)return n.length}return 0}f.prototype.eventNames=function(){return this._eventsCount>0?Ie(this._events):[]};function Ve(e,t){for(var n=new Array(t),i=0;i<t;++i)n[i]=e[i];return n}function Ct(e,t){for(;t+1<e.length;t++)e[t]=e[t+1];e.pop()}function kt(e){for(var t=new Array(e.length),n=0;n<t.length;++n)t[n]=e[n].listener||e[n];return t}function xt(e,t){return new Promise(function(n,i){function r(l){e.removeListener(t,s),i(l)}function s(){typeof e.removeListener=="function"&&e.removeListener("error",r),n([].slice.call(arguments))}Ze(e,t,s,{once:!0}),t!=="error"&&Pt(e,r,{once:!0})})}function Pt(e,t,n){typeof e.on=="function"&&Ze(e,"error",t,n)}function Ze(e,t,n,i){if(typeof e.on=="function")i.once?e.once(t,n):e.on(t,n);else if(typeof e.addEventListener=="function")e.addEventListener(t,function r(s){i.once&&e.removeEventListener(t,r),n(s)});else throw new TypeError('The "emitter" argument must be of type EventEmitter. Received type '+typeof e)}var St=Te.exports;const ie="pc-designer-iframe-wrapper",ke="pc-designer-iframe";class Tt{constructor(t){b(this,M),b(this,O),b(this,z),b(this,U),p(this,"token"),p(this,"productId"),p(this,"options"),b(this,x,void 0),b(this,S,void 0);var n;if(this.token=t.token,this.productId=t.productId,this.options=t.options,k(this,x,(n=this.options)!=null&&n.designerUrl?this.options.designerUrl:{}.VITE_CUSTOMIZER_URL?{}.VITE_CUSTOMIZER_URL:"https://customizer.printcart.com"),k(this,S,new St),!this.token||!this.productId){console.error("Missing Config Params");return}h(this,M,W).call(this),h(this,O,A).call(this)}render(){const t=document.getElementById(ie),n=document.getElementById(ke);if(!n||!(n instanceof HTMLIFrameElement)||!t){console.error("Can not find iframe element");return}const i=h(this,z,ne).call(this);n.src=i.href,t.style.opacity="1",t.style.visibility="visible",h(this,U,D).call(this,"rendered")}close(){const t=document.getElementById(ie);if(!t){console.error("Can not find iframe element");return}t.style.opacity="0",t.style.visibility="hidden",h(this,U,D).call(this,"closed")}editDesign(t){const n=h(this,z,ne).call(this);n.searchParams.set("design_id",t),n.searchParams.set("task","edit");const i=document.getElementById(ie),r=document.getElementById(ke);if(!r||!(r instanceof HTMLIFrameElement)||!i){console.error("Can not find iframe element");return}r.src=n.href,i.style.opacity="1",i.style.visibility="visible",h(this,U,D).call(this,"edit")}on(t,n){return L(this,S).on(t,n),this}}x=new WeakMap,S=new WeakMap,M=new WeakSet,W=function(){const e=document.createElement("div");e.id=ie,e.style.cssText="position:fixed;top:0;left:0;width:100vw;height:100vh;opacity:0;visibility:hidden;z-index:99999";const t=document.createElement("iframe");t.id=ke,t.width="100%",t.height="100%",e.appendChild(t),document.body.appendChild(e)},O=new WeakSet,A=function(){window.addEventListener("message",e=>{if(e.origin===L(this,x)&&e.data.message==="closeDesignTool"){const t=document.getElementById(ie);if(!t)return;t.style.opacity="0",t.style.visibility="hidden",h(this,U,D).call(this,"closed")}if(e.data.message==="finishLoad"){const t=document.getElementById(ke);h(this,U,D).call(this,"render-finish"),t&&t instanceof HTMLIFrameElement&&t.contentWindow&&t.contentWindow.postMessage({message:"customSettings",settings:this.options},L(this,x))}e.data.message==="finishProcess"&&h(this,U,D).call(this,"upload-success",e.data.data.data),e.data.message==="finishUpdate"&&h(this,U,D).call(this,"edit-success",e.data.data.data),e.data.message==="uploadError"&&h(this,U,D).call(this,"upload-error",e.data)},!1)},z=new WeakSet,ne=function(){const e=new URL(L(this,x));return e.searchParams.set("api_key",this.token),e.searchParams.set("product_id",this.productId),e.searchParams.set("parentUrl",window.location.href),e},U=new WeakSet,D=function(e,...t){L(this,S).emit(e,...t)};var Me=(e,t,n)=>{if(!t.has(e))throw TypeError("Cannot "+n)},T=(e,t,n)=>(Me(e,t,"read from private field"),n?n.call(e):t.get(e)),N=(e,t,n)=>{if(t.has(e))throw TypeError("Cannot add the same private member more than once");t instanceof WeakSet?t.add(e):t.set(e,n)},X=(e,t,n,i)=>(Me(e,t,"write to private field"),i?i.call(e,n):t.set(e,n),n),H=(e,t,n)=>(Me(e,t,"access private method"),n),re,J,V,se,oe,ce,F,Z,Oe,Ye,Ue,Ge,je={exports:{}},Y=typeof Reflect=="object"?Reflect:null,Qe=Y&&typeof Y.apply=="function"?Y.apply:function(e,t,n){return Function.prototype.apply.call(e,t,n)},xe;Y&&typeof Y.ownKeys=="function"?xe=Y.ownKeys:Object.getOwnPropertySymbols?xe=function(e){return Object.getOwnPropertyNames(e).concat(Object.getOwnPropertySymbols(e))}:xe=function(e){return Object.getOwnPropertyNames(e)};function Mt(e){console&&console.warn&&console.warn(e)}var et=Number.isNaN||function(e){return e!==e};function m(){m.init.call(this)}je.exports=m,je.exports.once=Wt,m.EventEmitter=m,m.prototype._events=void 0,m.prototype._eventsCount=0,m.prototype._maxListeners=void 0;var tt=10;function Pe(e){if(typeof e!="function")throw new TypeError('The "listener" argument must be of type Function. Received type '+typeof e)}Object.defineProperty(m,"defaultMaxListeners",{enumerable:!0,get:function(){return tt},set:function(e){if(typeof e!="number"||e<0||et(e))throw new RangeError('The value of "defaultMaxListeners" is out of range. It must be a non-negative number. Received '+e+".");tt=e}}),m.init=function(){(this._events===void 0||this._events===Object.getPrototypeOf(this)._events)&&(this._events=Object.create(null),this._eventsCount=0),this._maxListeners=this._maxListeners||void 0},m.prototype.setMaxListeners=function(e){if(typeof e!="number"||e<0||et(e))throw new RangeError('The value of "n" is out of range. It must be a non-negative number. Received '+e+".");return this._maxListeners=e,this};function nt(e){return e._maxListeners===void 0?m.defaultMaxListeners:e._maxListeners}m.prototype.getMaxListeners=function(){return nt(this)},m.prototype.emit=function(e){for(var t=[],n=1;n<arguments.length;n++)t.push(arguments[n]);var i=e==="error",r=this._events;if(r!==void 0)i=i&&r.error===void 0;else if(!i)return!1;if(i){var s;if(t.length>0&&(s=t[0]),s instanceof Error)throw s;var l=new Error("Unhandled error."+(s?" ("+s.message+")":""));throw l.context=s,l}var _=r[e];if(_===void 0)return!1;if(typeof _=="function")Qe(_,this,t);else for(var ae=_.length,De=ct(_,ae),n=0;n<ae;++n)Qe(De[n],this,t);return!0};function it(e,t,n,i){var r,s,l;if(Pe(n),s=e._events,s===void 0?(s=e._events=Object.create(null),e._eventsCount=0):(s.newListener!==void 0&&(e.emit("newListener",t,n.listener?n.listener:n),s=e._events),l=s[t]),l===void 0)l=s[t]=n,++e._eventsCount;else if(typeof l=="function"?l=s[t]=i?[n,l]:[l,n]:i?l.unshift(n):l.push(n),r=nt(e),r>0&&l.length>r&&!l.warned){l.warned=!0;var _=new Error("Possible EventEmitter memory leak detected. "+l.length+" "+String(t)+" listeners added. Use emitter.setMaxListeners() to increase limit");_.name="MaxListenersExceededWarning",_.emitter=e,_.type=t,_.count=l.length,Mt(_)}return e}m.prototype.addListener=function(e,t){return it(this,e,t,!1)},m.prototype.on=m.prototype.addListener,m.prototype.prependListener=function(e,t){return it(this,e,t,!0)};function Ot(){if(!this.fired)return this.target.removeListener(this.type,this.wrapFn),this.fired=!0,arguments.length===0?this.listener.call(this.target):this.listener.apply(this.target,arguments)}function rt(e,t,n){var i={fired:!1,wrapFn:void 0,target:e,type:t,listener:n},r=Ot.bind(i);return r.listener=n,i.wrapFn=r,r}m.prototype.once=function(e,t){return Pe(t),this.on(e,rt(this,e,t)),this},m.prototype.prependOnceListener=function(e,t){return Pe(t),this.prependListener(e,rt(this,e,t)),this},m.prototype.removeListener=function(e,t){var n,i,r,s,l;if(Pe(t),i=this._events,i===void 0)return this;if(n=i[e],n===void 0)return this;if(n===t||n.listener===t)--this._eventsCount===0?this._events=Object.create(null):(delete i[e],i.removeListener&&this.emit("removeListener",e,n.listener||t));else if(typeof n!="function"){for(r=-1,s=n.length-1;s>=0;s--)if(n[s]===t||n[s].listener===t){l=n[s].listener,r=s;break}if(r<0)return this;r===0?n.shift():Ut(n,r),n.length===1&&(i[e]=n[0]),i.removeListener!==void 0&&this.emit("removeListener",e,l||t)}return this},m.prototype.off=m.prototype.removeListener,m.prototype.removeAllListeners=function(e){var t,n,i;if(n=this._events,n===void 0)return this;if(n.removeListener===void 0)return arguments.length===0?(this._events=Object.create(null),this._eventsCount=0):n[e]!==void 0&&(--this._eventsCount===0?this._events=Object.create(null):delete n[e]),this;if(arguments.length===0){var r=Object.keys(n),s;for(i=0;i<r.length;++i)s=r[i],s!=="removeListener"&&this.removeAllListeners(s);return this.removeAllListeners("removeListener"),this._events=Object.create(null),this._eventsCount=0,this}if(t=n[e],typeof t=="function")this.removeListener(e,t);else if(t!==void 0)for(i=t.length-1;i>=0;i--)this.removeListener(e,t[i]);return this};function st(e,t,n){var i=e._events;if(i===void 0)return[];var r=i[t];return r===void 0?[]:typeof r=="function"?n?[r.listener||r]:[r]:n?jt(r):ct(r,r.length)}m.prototype.listeners=function(e){return st(this,e,!0)},m.prototype.rawListeners=function(e){return st(this,e,!1)},m.listenerCount=function(e,t){return typeof e.listenerCount=="function"?e.listenerCount(t):ot.call(e,t)},m.prototype.listenerCount=ot;function ot(e){var t=this._events;if(t!==void 0){var n=t[e];if(typeof n=="function")return 1;if(n!==void 0)return n.length}return 0}m.prototype.eventNames=function(){return this._eventsCount>0?xe(this._events):[]};function ct(e,t){for(var n=new Array(t),i=0;i<t;++i)n[i]=e[i];return n}function Ut(e,t){for(;t+1<e.length;t++)e[t]=e[t+1];e.pop()}function jt(e){for(var t=new Array(e.length),n=0;n<t.length;++n)t[n]=e[n].listener||e[n];return t}function Wt(e,t){return new Promise(function(n,i){function r(l){e.removeListener(t,s),i(l)}function s(){typeof e.removeListener=="function"&&e.removeListener("error",r),n([].slice.call(arguments))}at(e,t,s,{once:!0}),t!=="error"&&Dt(e,r,{once:!0})})}function Dt(e,t,n){typeof e.on=="function"&&at(e,"error",t,n)}function at(e,t,n,i){if(typeof e.on=="function")i.once?e.once(t,n):e.on(t,n);else if(typeof e.addEventListener=="function")e.addEventListener(t,function r(s){i.once&&e.removeEventListener(t,r),n(s)});else throw new TypeError('The "emitter" argument must be of type EventEmitter. Received type '+typeof e)}var Nt=je.exports;const Se="pc-uploader-iframe-wrapper",We="pc-uploader-iframe";class Rt{constructor(t){if(N(this,F),N(this,Oe),N(this,Ue),N(this,re,void 0),N(this,J,void 0),N(this,V,void 0),N(this,se,void 0),N(this,oe,void 0),N(this,ce,void 0),X(this,re,t.token),X(this,J,t.sideId||t.productId),X(this,ce,t.productId?"product":"side"),X(this,V,t.uploaderUrl?t.uploaderUrl:"https://upload-tool.pages.dev"),X(this,se,new Nt),X(this,oe,t.locale),!T(this,re)||!T(this,J)){console.warn("Missing Config Params.");return}H(this,Oe,Ye).call(this),H(this,Ue,Ge).call(this)}get locale(){return T(this,oe)}open(){let t=document.getElementById(Se),n=document.getElementById(We);const i=new URL(T(this,V));if(i.searchParams.set("token",T(this,re)),T(this,ce)==="side"?i.searchParams.set("sideId",T(this,J)):T(this,ce)==="product"&&i.searchParams.set("productId",T(this,J)),i.searchParams.set("parentUrl",window.location.href),!n||!(n instanceof HTMLIFrameElement)||!t){console.warn("Can not find iframe element.");return}n.src=i.href,t.style.opacity="1",t.style.visibility="visible",H(this,F,Z).call(this,"open")}close(){let t=document.getElementById(Se);if(!t){console.error("Can not find iframe element");return}t.style.opacity="0",t.style.visibility="hidden"}on(t,n){return T(this,se).on(t,n),this}}re=new WeakMap,J=new WeakMap,V=new WeakMap,se=new WeakMap,oe=new WeakMap,ce=new WeakMap,F=new WeakSet,Z=function(e,...t){T(this,se).emit(e,...t)},Oe=new WeakSet,Ye=function(){let e=document.createElement("div");e.id=Se,e.style.cssText="position:fixed;top:0;left:0;width:100vw;height:100vh;opacity:0;visibility:hidden;z-index:99999";let t=document.createElement("iframe");t.id=We,t.width="100%",t.height="100%",t.style.borderWidth="0",e.appendChild(t),document.body.appendChild(e)},Ue=new WeakSet,Ge=function(){let e=document.getElementById(Se);window.addEventListener("message",t=>{var n;const i=new URL(t.origin),r=new URL(T(this,V));if(i.host===r.host){t.data.uploaderEvent==="close"&&e&&(e.style.opacity="0",e.style.visibility="hidden",H(this,F,Z).call(this,"close")),t.data.uploaderEvent==="upload-success"&&H(this,F,Z).call(this,"upload-success",t.data.data),t.data.uploaderEvent==="upload-error"&&H(this,F,Z).call(this,"upload-error",t.data.error);const s=T(this,oe),l=document.getElementById(We);l&&l instanceof HTMLIFrameElement&&(H(this,F,Z).call(this,"onload"),s&&t.data.uploaderEvent==="loaded"&&t.data.finished&&(console.log("test"),l.focus(),(n=l.contentWindow)==null||n.postMessage({locale:s},T(this,V))))}},!1)};class Bt{constructor(){o(this,"initDesignTool",t=>new Tt(t)),o(this,"initUploader",t=>new Rt(t))}}return Bt}();var w="";const I=new g;class le{constructor(){E(this,ee);E(this,te);E(this,de);E(this,pe);E(this,R);E(this,ue);E(this,he);E(this,fe);E(this,me);E(this,ve);E(this,ge);E(this,ye);E(this,we);E(this,be);E(this,_e);E(this,Ee);E(this,Le);E(this,$,void 0);B(this,"token");B(this,"appID");B(this,"productIdPC");B(this,"orderIdWix");B(this,"orderNumberWix");B(this,"options");E(this,Q,void 0);E(this,C,void 0);E(this,P,void 0);E(this,j,void 0);B(this,"registerListener");this.token=y(this,ye,gt).call(this),this.productIdPC=null,this.appID="325c68a5-64c2-440d-b093-8cea369df06b",this.orderIdWix=null,this.orderNumberWix=null,q(this,j,null),this.options=window.PrintcartDesignerShopifyOptions,q(this,$,"https://api.printcart.com/v1"),q(this,Q,"https://customizer.printcart.com")}init(){const c=window,o=this;c!=null&&c.wixDevelopersAnalytics?y(this,ee,Re).call(this,"first"):c.addEventListener("wixDevelopersAnalyticsReady",function(){var a;y(a=o,ee,Re).call(a,"second")})}}$=new WeakMap,Q=new WeakMap,C=new WeakMap,P=new WeakMap,j=new WeakMap,ee=new WeakSet,Re=function(c){const o=this;console.log("Printcart start App "+c),window==null||window.wixDevelopersAnalytics.register(this.appID,function(d,p){var v,L,b;switch(d){case"ViewContent":localStorage.getItem("pc-product")&&localStorage.removeItem("pc-product");break;case"productPageLoaded":if(console.log("Printcart: productPageLoaded",p),p.variants&&p.variants.length>1)return;y(v=o,te,Be).call(v,p==null?void 0:p.productId);break;case"CustomizeProduct":if(p.variants&&p.variants.length<1)return;y(L=o,te,Be).call(L,p==null?void 0:p.variantId);break;case"Purchase":if(!localStorage.getItem("pc-design-ids"))return;const k=localStorage.getItem("pc-design-ids");if(o.orderIdWix=p==null?void 0:p.orderId,o.orderNumberWix=p==null?void 0:p.id,!o.orderIdWix)throw new Error("Can not find order ID WIX");if(!o.orderNumberWix)throw new Error("Can not find order number WIX");if(!k)throw new Error("Can not find design Ids");y(b=o,Le,Et).call(b,o.orderNumberWix,o.orderIdWix,JSON.parse(k));break}})},te=new WeakSet,Be=function(c){if(q(this,j,document.querySelector("[data-hook='product-options']")),!u(this,j))throw new Error("This script can only be used inside a Wix Product Page.");if(!c)throw new Error("Can not find product ID WIX");y(this,_e,bt).call(this,c).then(o=>{var L,b;if(this.productIdPC=(L=o==null?void 0:o.data)==null?void 0:L.id,!this.productIdPC)throw new Error("Can not find product ID Printcart");y(this,be,wt).call(this),y(this,Ee,_t).call(this),y(this,de,lt).call(this),y(this,ue,pt).call(this),y(this,he,ut).call(this);const a=document.querySelector("button#pc-btn"),d=o.data.enable_design,p=o.data.enable_upload;d&&(q(this,C,I.initDesignTool({token:this.token,productId:this.productIdPC,options:{...(b=this.options)==null?void 0:b.designerOptions,designerUrl:u(this,Q)}})),y(this,ge,vt).call(this),a&&a instanceof HTMLButtonElement&&(a.disabled=!1)),p&&(q(this,P,I.initUploader({token:this.token,productId:this.productIdPC})),y(this,ve,mt).call(this),a&&a instanceof HTMLButtonElement&&(a.disabled=!1));const v=()=>{u(this,C)&&!u(this,P)&&u(this,C).render(),!u(this,C)&&u(this,P)&&u(this,P).open(),u(this,C)&&u(this,P)&&y(this,pe,dt).call(this)};a&&a instanceof HTMLButtonElement&&(a.onclick=v)})},de=new WeakSet,lt=function(){const a='<button aria-label="Close" id="pc-select_close-btn"><span data-modal-x></span></button><div class="pc-select-wrap" id="pc-content-overlay"><div class="pc-select-inner"><div id="pc-select_header">Choose a way to design this product</div><div id="pc-select_container"><button class="pc-select_btn" id="pc-select_btn_upload"><div aria-hidden="true" class="pc-select_btn_wrap"><div class="pc-select_btn_img"><div class="pc-select_btn_img_inner"><img src="https://files.printcart.com/common/upload.svg" alt="Printcart Uploader"></div></div><div class="pc-select_btn_content"><div class="pc-select_btn_content_inner"><h2 class="pc-title">Upload a full design</h2><ul><li>Have a complete design</li><li>Have your own designer</li></ul></div></div></div><div class="visually-hidden">Upload Design file</div></button><button class="pc-select_btn" id="pc-select_btn_design"><div aria-hidden="true" class="pc-select_btn_wrap"><div class="pc-select_btn_img"><div class="pc-select_btn_img_inner"><img src="https://files.printcart.com/common/design.svg" alt="Printcart Designer"></div></div><div class="pc-select_btn_content"><div class="pc-select_btn_content_inner"><h2 class="pc-title">Design here online</h2><ul><li>Already have your concept</li><li>Customize every details</li></ul></div></div></div><div class="visually-hidden">Upload Design file</div></button></div></div></div>',d=document.createElement("div");d.id="pc-select_wrap",d.setAttribute("role","dialog"),d.setAttribute("aria-modal","true"),d.setAttribute("tabIndex","-1"),d.innerHTML=a,document.body.appendChild(d);const p=()=>{u(this,C)&&(y(this,R,G).call(this),u(this,C).render(),document.body.classList.add("pc-overflow"))},v=()=>{u(this,P)&&(y(this,R,G).call(this),u(this,P).open(),document.body.classList.add("pc-overflow"))},L=document.getElementById("pc-select_btn_upload"),b=document.getElementById("pc-select_btn_design");L&&(L==null||L.addEventListener("click",v)),b&&(b==null||b.addEventListener("click",p))},pe=new WeakSet,dt=function(){const c=document.getElementById("pc-select_wrap");c&&(c.style.display="flex",document.body.classList.add("pc-overflow"));const o=c==null?void 0:c.querySelector("#pc-select_close-btn");o&&o instanceof HTMLButtonElement&&o.focus()},R=new WeakSet,G=function(){const c=document.getElementById("pc-select_wrap");c&&(c.style.display="none"),document.body.classList.remove("pc-overflow")},ue=new WeakSet,pt=function(){const c=document.getElementById("pc-select_close-btn"),o=document.getElementById("pc-content-overlay"),a=d=>{d.key==="Escape"&&y(this,R,G).call(this)};window.addEventListener("keydown",a),c==null||c.addEventListener("click",()=>y(this,R,G).call(this)),o==null||o.addEventListener("click",()=>{const d=document.getElementById("pc-designer-iframe-wrapper");(d==null?void 0:d.style.visibility)!=="visible"&&y(this,R,G).call(this)})},he=new WeakSet,ut=function(){const c=document.getElementById("pc-select_wrap"),o=c==null?void 0:c.querySelectorAll("button"),a=o&&o[0],d=o&&o[o.length-1],p=v=>{v.key==="Tab"&&(v.shiftKey?d&&document.activeElement===a&&(d.focus(),v.preventDefault()):a&&document.activeElement===d&&(a.focus(),v.preventDefault()))};window.addEventListener("keydown",p)},fe=new WeakSet,ht=function(c){var L,b;const o=c.map(k=>k.data.id);let a=document.querySelector('input[name="properties[_pcDesignIds]"]');a?a.value+=`,${o.join()}`:(a=document.createElement("input"),a.type="hidden",a.name="properties[_pcDesignIds]",a.className="pc-designer_input",a.value=o.join(),(L=u(this,j))==null||L.appendChild(a));const d=document.querySelector(".pc-preview-wrap")||document.createElement("div");d.className="pc-preview-wrap",localStorage.getItem("pc-design-ids")&&localStorage.removeItem("pc-design-ids"),localStorage.setItem("pc-design-ids",JSON.stringify(o)),c.forEach(k=>{var W;if(!k.data.design_image.url)return;const h=document.createElement("div");h.className="pc-preview",h.setAttribute("data-pc-design-id",k.data.id);const x=document.createElement("button");x.className="pc-btn pc-danger-btn",x.innerHTML=(W=this.options)!=null&&W.removeUploaderBtnText?this.options.removeUploaderBtnText:"Remove",x.onclick=()=>{const O=a.value.split(",").filter(A=>A!==k.data.id);a.value=O.join(),h.remove()};const S=document.createElement("img");S.src=k.data.design_image.url,S.className="pc-uploader-image";const M=document.createElement("div");M.className="pc-preview-overlay",M.appendChild(x),h.appendChild(M),h.appendChild(S),d.appendChild(h)});const p=document.querySelector("div#pc-designer_wrap");if(!document.querySelector(".princart-preview-heading")){const k=document.createElement("h5");k.className="princart-preview-heading",k.innerHTML="Your artworks",p==null||p.appendChild(k)}p==null||p.appendChild(d);const v=(b=this.options)==null?void 0:b.onUploadSuccess;v&&v(c,u(this,P))},me=new WeakSet,ft=function(c){var b,k;const o=this,a=c.map(h=>h.id);let d=document.querySelector('input[name="properties[_pcDesignIds]"]');d?d.value+=`,${a.join()}`:(d=document.createElement("input"),d.type="hidden",d.name="properties[_pcDesignIds]",d.className="pc-designer_input",d.value=a.join(),(b=u(this,j))==null||b.appendChild(d));const p=document.querySelector(".pc-preview-wrap")||document.createElement("div");p.className="pc-preview-wrap",localStorage.getItem("pc-design-ids")&&localStorage.removeItem("pc-design-ids"),localStorage.setItem("pc-design-ids",JSON.stringify(a)),c.forEach(h=>{var A;if(!h.design_image.url)return;const x=document.createElement("div");x.className="pc-preview",x.setAttribute("data-pc-design-id",h.id);const S=document.createElement("button");S.className="pc-btn pc-primary-btn",S.style.borderRadius="5px",S.innerHTML="Edit",S.onclick=()=>{u(o,C).editDesign(h.id)};const M=document.createElement("button");M.className="pc-btn pc-danger-btn",M.style.borderRadius="5px",M.innerHTML="Remove",M.onclick=()=>{const z=d.value.split(",").filter(ne=>ne!==h.id);d.value=z.join(),x.remove()};const W=document.createElement("img");W.src=((A=h.preview_image)==null?void 0:A.url)||h.design_image.url,W.className="pc-uploader-image";const O=document.createElement("div");O.className="pc-preview-overlay",O.appendChild(S),O.appendChild(M),x.appendChild(O),x.appendChild(W),p.appendChild(x)});const v=document.querySelector("div#pc-designer_wrap");v==null||v.appendChild(p);const L=(k=this.options)==null?void 0:k.onDesignCreateSuccess;L&&L(c,u(this,C))},ve=new WeakSet,mt=function(){u(this,P)&&(u(this,P).on("upload-success",c=>{y(this,fe,ht).call(this,c),u(this,P).close()}),u(this,P).on("close",()=>{document.body.classList.remove("pc-overflow")}))},ge=new WeakSet,vt=function(){u(this,C)&&(u(this,C).on("upload-success",c=>{y(this,me,ft).call(this,c),u(this,C).close()}),u(this,C).on("closed",()=>{document.body.classList.remove("pc-overflow")}),u(this,C).on("edit-success",c=>{var d;if(!c.design_image.url)return;const o=document.querySelector(`[data-pc-design-id="${c.id}"] img`);if(!o||!(o instanceof HTMLImageElement))throw new Error("Can't find image element");o.src=c.design_image.url;const a=(d=this.options)==null?void 0:d.onDesignEditSuccess;u(this,C).close(),a&&a(c,u(this,C))}))},ye=new WeakSet,gt=function(){const c=y(this,we,yt).call(this),o=new URL(c);return new URLSearchParams(o.search).get("shopT")},we=new WeakSet,yt=function(){return document.querySelector("[id='pc-wix-integration-sdk']").src},be=new WeakSet,wt=function(){const c="https://unpkg.com/@printcart/wix-integration/dist",o=document.createElement("link");o.rel="stylesheet",o.href=`${c}/style.css`,document.head.appendChild(o)},_e=new WeakSet,bt=async function(c){try{const o=`${u(this,$)}/integration/wix/products/${c}`,a=this.token;if(!a)throw new Error("Missing Printcart Unauth Token");return await(await fetch(o,{headers:{"X-PrintCart-Unauth-Token":a}})).json()}catch(o){console.error("There has been a problem with your fetch operation:",o);return}},Ee=new WeakSet,_t=function(){var d,p,v;const c=u(this,j);if(!(c!=null&&c.parentNode)){console.log("Can not find cart form");return}if(document.getElementById("pc-designer_wrap")!==null)return;const o=document.createElement("div");o.id="pc-designer_wrap";const a=document.createElement("button");a.id="pc-btn",a.className=(d=this.options)!=null&&d.designClassName?(p=this.options)==null?void 0:p.designClassName:"",a.innerHTML=(v=this.options)!=null&&v.designBtnText?this.options.designBtnText:"Start Design",a.disabled=!0,o.appendChild(a),c.appendChild(o)},Le=new WeakSet,Et=async function(c,o,a){try{const d=`${u(this,$)}/projects`,p=this.token;if(!p)throw new Error("Missing Printcart Unauth Token");const v={name:`${c}`,status:"processing",design_ids:a,order_detail:{id:o}};await fetch(d,{method:"POST",headers:{"Content-Type":"application/json","X-PrintCart-Unauth-Token":p},body:JSON.stringify(v)})}catch(d){console.error("There has been a problem with your fetch operation:",d);return}},new le().init()});
var At=Object.defineProperty;var Ht=(y,w,I)=>w in y?At(y,w,{enumerable:!0,configurable:!0,writable:!0,value:I}):y[w]=I;var A=(y,w,I)=>(Ht(y,typeof w!="symbol"?w+"":w,I),I),Ne=(y,w,I)=>{if(!w.has(y))throw TypeError("Cannot "+I)};var u=(y,w,I)=>(Ne(y,w,"read from private field"),I?I.call(y):w.get(y)),E=(y,w,I)=>{if(w.has(y))throw TypeError("Cannot add the same private member more than once");w instanceof WeakSet?w.add(y):w.set(y,I)},$=(y,w,I,le)=>(Ne(y,w,"write to private field"),le?le.call(y,I):w.set(y,I),I);var g=(y,w,I)=>(Ne(y,w,"access private method"),I);(function(){var z,Q,k,P,D,ee,Re,te,Be,de,lt,pe,dt,B,G,ue,pt,he,ut,fe,ht,me,ft,ve,mt,ge,vt,ye,gt,we,yt,be,wt,_e,bt,Ee,_t,Le,Et;"use strict";const y=function(){var Ae=Object.defineProperty,c=(e,t,n)=>t in e?Ae(e,t,{enumerable:!0,configurable:!0,writable:!0,value:n}):e[t]=n,o=(e,t,n)=>(c(e,typeof t!="symbol"?t+"":t,n),n),a=Object.defineProperty,d=(e,t,n)=>t in e?a(e,t,{enumerable:!0,configurable:!0,writable:!0,value:n}):e[t]=n,p=(e,t,n)=>(d(e,typeof t!="symbol"?t+"":t,n),n),v=(e,t,n)=>{if(!t.has(e))throw TypeError("Cannot "+n)},L=(e,t,n)=>(v(e,t,"read from private field"),n?n.call(e):t.get(e)),b=(e,t,n)=>{if(t.has(e))throw TypeError("Cannot add the same private member more than once");t instanceof WeakSet?t.add(e):t.set(e,n)},C=(e,t,n,i)=>(v(e,t,"write to private field"),i?i.call(e,n):t.set(e,n),n),h=(e,t,n)=>(v(e,t,"access private method"),n),x,S,M,W,U,H,j,ne,O,N,Te={exports:{}},K=typeof Reflect=="object"?Reflect:null,He=K&&typeof K.apply=="function"?K.apply:function(e,t,n){return Function.prototype.apply.call(e,t,n)},Ie;K&&typeof K.ownKeys=="function"?Ie=K.ownKeys:Object.getOwnPropertySymbols?Ie=function(e){return Object.getOwnPropertyNames(e).concat(Object.getOwnPropertySymbols(e))}:Ie=function(e){return Object.getOwnPropertyNames(e)};function Lt(e){console&&console.warn&&console.warn(e)}var Fe=Number.isNaN||function(e){return e!==e};function f(){f.init.call(this)}Te.exports=f,Te.exports.once=xt,f.EventEmitter=f,f.prototype._events=void 0,f.prototype._eventsCount=0,f.prototype._maxListeners=void 0;var qe=10;function Ce(e){if(typeof e!="function")throw new TypeError('The "listener" argument must be of type Function. Received type '+typeof e)}Object.defineProperty(f,"defaultMaxListeners",{enumerable:!0,get:function(){return qe},set:function(e){if(typeof e!="number"||e<0||Fe(e))throw new RangeError('The value of "defaultMaxListeners" is out of range. It must be a non-negative number. Received '+e+".");qe=e}}),f.init=function(){(this._events===void 0||this._events===Object.getPrototypeOf(this)._events)&&(this._events=Object.create(null),this._eventsCount=0),this._maxListeners=this._maxListeners||void 0},f.prototype.setMaxListeners=function(e){if(typeof e!="number"||e<0||Fe(e))throw new RangeError('The value of "n" is out of range. It must be a non-negative number. Received '+e+".");return this._maxListeners=e,this};function $e(e){return e._maxListeners===void 0?f.defaultMaxListeners:e._maxListeners}f.prototype.getMaxListeners=function(){return $e(this)},f.prototype.emit=function(e){for(var t=[],n=1;n<arguments.length;n++)t.push(arguments[n]);var i=e==="error",r=this._events;if(r!==void 0)i=i&&r.error===void 0;else if(!i)return!1;if(i){var s;if(t.length>0&&(s=t[0]),s instanceof Error)throw s;var l=new Error("Unhandled error."+(s?" ("+s.message+")":""));throw l.context=s,l}var _=r[e];if(_===void 0)return!1;if(typeof _=="function")He(_,this,t);else for(var ae=_.length,We=Ve(_,ae),n=0;n<ae;++n)He(We[n],this,t);return!0};function ze(e,t,n,i){var r,s,l;if(Ce(n),s=e._events,s===void 0?(s=e._events=Object.create(null),e._eventsCount=0):(s.newListener!==void 0&&(e.emit("newListener",t,n.listener?n.listener:n),s=e._events),l=s[t]),l===void 0)l=s[t]=n,++e._eventsCount;else if(typeof l=="function"?l=s[t]=i?[n,l]:[l,n]:i?l.unshift(n):l.push(n),r=$e(e),r>0&&l.length>r&&!l.warned){l.warned=!0;var _=new Error("Possible EventEmitter memory leak detected. "+l.length+" "+String(t)+" listeners added. Use emitter.setMaxListeners() to increase limit");_.name="MaxListenersExceededWarning",_.emitter=e,_.type=t,_.count=l.length,Lt(_)}return e}f.prototype.addListener=function(e,t){return ze(this,e,t,!1)},f.prototype.on=f.prototype.addListener,f.prototype.prependListener=function(e,t){return ze(this,e,t,!0)};function It(){if(!this.fired)return this.target.removeListener(this.type,this.wrapFn),this.fired=!0,arguments.length===0?this.listener.call(this.target):this.listener.apply(this.target,arguments)}function Ke(e,t,n){var i={fired:!1,wrapFn:void 0,target:e,type:t,listener:n},r=It.bind(i);return r.listener=n,i.wrapFn=r,r}f.prototype.once=function(e,t){return Ce(t),this.on(e,Ke(this,e,t)),this},f.prototype.prependOnceListener=function(e,t){return Ce(t),this.prependListener(e,Ke(this,e,t)),this},f.prototype.removeListener=function(e,t){var n,i,r,s,l;if(Ce(t),i=this._events,i===void 0)return this;if(n=i[e],n===void 0)return this;if(n===t||n.listener===t)--this._eventsCount===0?this._events=Object.create(null):(delete i[e],i.removeListener&&this.emit("removeListener",e,n.listener||t));else if(typeof n!="function"){for(r=-1,s=n.length-1;s>=0;s--)if(n[s]===t||n[s].listener===t){l=n[s].listener,r=s;break}if(r<0)return this;r===0?n.shift():Ct(n,r),n.length===1&&(i[e]=n[0]),i.removeListener!==void 0&&this.emit("removeListener",e,l||t)}return this},f.prototype.off=f.prototype.removeListener,f.prototype.removeAllListeners=function(e){var t,n,i;if(n=this._events,n===void 0)return this;if(n.removeListener===void 0)return arguments.length===0?(this._events=Object.create(null),this._eventsCount=0):n[e]!==void 0&&(--this._eventsCount===0?this._events=Object.create(null):delete n[e]),this;if(arguments.length===0){var r=Object.keys(n),s;for(i=0;i<r.length;++i)s=r[i],s!=="removeListener"&&this.removeAllListeners(s);return this.removeAllListeners("removeListener"),this._events=Object.create(null),this._eventsCount=0,this}if(t=n[e],typeof t=="function")this.removeListener(e,t);else if(t!==void 0)for(i=t.length-1;i>=0;i--)this.removeListener(e,t[i]);return this};function Xe(e,t,n){var i=e._events;if(i===void 0)return[];var r=i[t];return r===void 0?[]:typeof r=="function"?n?[r.listener||r]:[r]:n?kt(r):Ve(r,r.length)}f.prototype.listeners=function(e){return Xe(this,e,!0)},f.prototype.rawListeners=function(e){return Xe(this,e,!1)},f.listenerCount=function(e,t){return typeof e.listenerCount=="function"?e.listenerCount(t):Je.call(e,t)},f.prototype.listenerCount=Je;function Je(e){var t=this._events;if(t!==void 0){var n=t[e];if(typeof n=="function")return 1;if(n!==void 0)return n.length}return 0}f.prototype.eventNames=function(){return this._eventsCount>0?Ie(this._events):[]};function Ve(e,t){for(var n=new Array(t),i=0;i<t;++i)n[i]=e[i];return n}function Ct(e,t){for(;t+1<e.length;t++)e[t]=e[t+1];e.pop()}function kt(e){for(var t=new Array(e.length),n=0;n<t.length;++n)t[n]=e[n].listener||e[n];return t}function xt(e,t){return new Promise(function(n,i){function r(l){e.removeListener(t,s),i(l)}function s(){typeof e.removeListener=="function"&&e.removeListener("error",r),n([].slice.call(arguments))}Ze(e,t,s,{once:!0}),t!=="error"&&Pt(e,r,{once:!0})})}function Pt(e,t,n){typeof e.on=="function"&&Ze(e,"error",t,n)}function Ze(e,t,n,i){if(typeof e.on=="function")i.once?e.once(t,n):e.on(t,n);else if(typeof e.addEventListener=="function")e.addEventListener(t,function r(s){i.once&&e.removeEventListener(t,r),n(s)});else throw new TypeError('The "emitter" argument must be of type EventEmitter. Received type '+typeof e)}var St=Te.exports;const ie="pc-designer-iframe-wrapper",ke="pc-designer-iframe";class Tt{constructor(t){b(this,M),b(this,U),b(this,j),b(this,O),p(this,"token"),p(this,"productId"),p(this,"options"),b(this,x,void 0),b(this,S,void 0);var n;if(this.token=t.token,this.productId=t.productId,this.options=t.options,C(this,x,(n=this.options)!=null&&n.designerUrl?this.options.designerUrl:{}.VITE_CUSTOMIZER_URL?{}.VITE_CUSTOMIZER_URL:"https://customizer.printcart.com"),C(this,S,new St),!this.token||!this.productId){console.error("Missing Config Params");return}h(this,M,W).call(this),h(this,U,H).call(this)}render(){const t=document.getElementById(ie),n=document.getElementById(ke);if(!n||!(n instanceof HTMLIFrameElement)||!t){console.error("Can not find iframe element");return}const i=h(this,j,ne).call(this);n.src=i.href,t.style.opacity="1",t.style.visibility="visible",h(this,O,N).call(this,"rendered")}close(){const t=document.getElementById(ie);if(!t){console.error("Can not find iframe element");return}t.style.opacity="0",t.style.visibility="hidden",h(this,O,N).call(this,"closed")}editDesign(t){const n=h(this,j,ne).call(this);n.searchParams.set("design_id",t),n.searchParams.set("task","edit");const i=document.getElementById(ie),r=document.getElementById(ke);if(!r||!(r instanceof HTMLIFrameElement)||!i){console.error("Can not find iframe element");return}r.src=n.href,i.style.opacity="1",i.style.visibility="visible",h(this,O,N).call(this,"edit")}on(t,n){return L(this,S).on(t,n),this}}x=new WeakMap,S=new WeakMap,M=new WeakSet,W=function(){const e=document.createElement("div");e.id=ie,e.style.cssText="position:fixed;top:0;left:0;width:100vw;height:100vh;opacity:0;visibility:hidden;z-index:99999";const t=document.createElement("iframe");t.id=ke,t.width="100%",t.height="100%",e.appendChild(t),document.body.appendChild(e)},U=new WeakSet,H=function(){window.addEventListener("message",e=>{if(e.origin===L(this,x)&&e.data.message==="closeDesignTool"){const t=document.getElementById(ie);if(!t)return;t.style.opacity="0",t.style.visibility="hidden",h(this,O,N).call(this,"closed")}if(e.data.message==="finishLoad"){const t=document.getElementById(ke);h(this,O,N).call(this,"render-finish"),t&&t instanceof HTMLIFrameElement&&t.contentWindow&&t.contentWindow.postMessage({message:"customSettings",settings:this.options},L(this,x))}e.data.message==="finishProcess"&&h(this,O,N).call(this,"upload-success",e.data.data.data),e.data.message==="finishUpdate"&&h(this,O,N).call(this,"edit-success",e.data.data.data),e.data.message==="uploadError"&&h(this,O,N).call(this,"upload-error",e.data)},!1)},j=new WeakSet,ne=function(){const e=new URL(L(this,x));return e.searchParams.set("api_key",this.token),e.searchParams.set("product_id",this.productId),e.searchParams.set("parentUrl",window.location.href),e},O=new WeakSet,N=function(e,...t){L(this,S).emit(e,...t)};var Me=(e,t,n)=>{if(!t.has(e))throw TypeError("Cannot "+n)},T=(e,t,n)=>(Me(e,t,"read from private field"),n?n.call(e):t.get(e)),R=(e,t,n)=>{if(t.has(e))throw TypeError("Cannot add the same private member more than once");t instanceof WeakSet?t.add(e):t.set(e,n)},X=(e,t,n,i)=>(Me(e,t,"write to private field"),i?i.call(e,n):t.set(e,n),n),F=(e,t,n)=>(Me(e,t,"access private method"),n),re,J,V,se,oe,ce,q,Z,Oe,Ye,Ue,Ge,je={exports:{}},Y=typeof Reflect=="object"?Reflect:null,Qe=Y&&typeof Y.apply=="function"?Y.apply:function(e,t,n){return Function.prototype.apply.call(e,t,n)},xe;Y&&typeof Y.ownKeys=="function"?xe=Y.ownKeys:Object.getOwnPropertySymbols?xe=function(e){return Object.getOwnPropertyNames(e).concat(Object.getOwnPropertySymbols(e))}:xe=function(e){return Object.getOwnPropertyNames(e)};function Mt(e){console&&console.warn&&console.warn(e)}var et=Number.isNaN||function(e){return e!==e};function m(){m.init.call(this)}je.exports=m,je.exports.once=Dt,m.EventEmitter=m,m.prototype._events=void 0,m.prototype._eventsCount=0,m.prototype._maxListeners=void 0;var tt=10;function Pe(e){if(typeof e!="function")throw new TypeError('The "listener" argument must be of type Function. Received type '+typeof e)}Object.defineProperty(m,"defaultMaxListeners",{enumerable:!0,get:function(){return tt},set:function(e){if(typeof e!="number"||e<0||et(e))throw new RangeError('The value of "defaultMaxListeners" is out of range. It must be a non-negative number. Received '+e+".");tt=e}}),m.init=function(){(this._events===void 0||this._events===Object.getPrototypeOf(this)._events)&&(this._events=Object.create(null),this._eventsCount=0),this._maxListeners=this._maxListeners||void 0},m.prototype.setMaxListeners=function(e){if(typeof e!="number"||e<0||et(e))throw new RangeError('The value of "n" is out of range. It must be a non-negative number. Received '+e+".");return this._maxListeners=e,this};function nt(e){return e._maxListeners===void 0?m.defaultMaxListeners:e._maxListeners}m.prototype.getMaxListeners=function(){return nt(this)},m.prototype.emit=function(e){for(var t=[],n=1;n<arguments.length;n++)t.push(arguments[n]);var i=e==="error",r=this._events;if(r!==void 0)i=i&&r.error===void 0;else if(!i)return!1;if(i){var s;if(t.length>0&&(s=t[0]),s instanceof Error)throw s;var l=new Error("Unhandled error."+(s?" ("+s.message+")":""));throw l.context=s,l}var _=r[e];if(_===void 0)return!1;if(typeof _=="function")Qe(_,this,t);else for(var ae=_.length,We=ct(_,ae),n=0;n<ae;++n)Qe(We[n],this,t);return!0};function it(e,t,n,i){var r,s,l;if(Pe(n),s=e._events,s===void 0?(s=e._events=Object.create(null),e._eventsCount=0):(s.newListener!==void 0&&(e.emit("newListener",t,n.listener?n.listener:n),s=e._events),l=s[t]),l===void 0)l=s[t]=n,++e._eventsCount;else if(typeof l=="function"?l=s[t]=i?[n,l]:[l,n]:i?l.unshift(n):l.push(n),r=nt(e),r>0&&l.length>r&&!l.warned){l.warned=!0;var _=new Error("Possible EventEmitter memory leak detected. "+l.length+" "+String(t)+" listeners added. Use emitter.setMaxListeners() to increase limit");_.name="MaxListenersExceededWarning",_.emitter=e,_.type=t,_.count=l.length,Mt(_)}return e}m.prototype.addListener=function(e,t){return it(this,e,t,!1)},m.prototype.on=m.prototype.addListener,m.prototype.prependListener=function(e,t){return it(this,e,t,!0)};function Ot(){if(!this.fired)return this.target.removeListener(this.type,this.wrapFn),this.fired=!0,arguments.length===0?this.listener.call(this.target):this.listener.apply(this.target,arguments)}function rt(e,t,n){var i={fired:!1,wrapFn:void 0,target:e,type:t,listener:n},r=Ot.bind(i);return r.listener=n,i.wrapFn=r,r}m.prototype.once=function(e,t){return Pe(t),this.on(e,rt(this,e,t)),this},m.prototype.prependOnceListener=function(e,t){return Pe(t),this.prependListener(e,rt(this,e,t)),this},m.prototype.removeListener=function(e,t){var n,i,r,s,l;if(Pe(t),i=this._events,i===void 0)return this;if(n=i[e],n===void 0)return this;if(n===t||n.listener===t)--this._eventsCount===0?this._events=Object.create(null):(delete i[e],i.removeListener&&this.emit("removeListener",e,n.listener||t));else if(typeof n!="function"){for(r=-1,s=n.length-1;s>=0;s--)if(n[s]===t||n[s].listener===t){l=n[s].listener,r=s;break}if(r<0)return this;r===0?n.shift():Ut(n,r),n.length===1&&(i[e]=n[0]),i.removeListener!==void 0&&this.emit("removeListener",e,l||t)}return this},m.prototype.off=m.prototype.removeListener,m.prototype.removeAllListeners=function(e){var t,n,i;if(n=this._events,n===void 0)return this;if(n.removeListener===void 0)return arguments.length===0?(this._events=Object.create(null),this._eventsCount=0):n[e]!==void 0&&(--this._eventsCount===0?this._events=Object.create(null):delete n[e]),this;if(arguments.length===0){var r=Object.keys(n),s;for(i=0;i<r.length;++i)s=r[i],s!=="removeListener"&&this.removeAllListeners(s);return this.removeAllListeners("removeListener"),this._events=Object.create(null),this._eventsCount=0,this}if(t=n[e],typeof t=="function")this.removeListener(e,t);else if(t!==void 0)for(i=t.length-1;i>=0;i--)this.removeListener(e,t[i]);return this};function st(e,t,n){var i=e._events;if(i===void 0)return[];var r=i[t];return r===void 0?[]:typeof r=="function"?n?[r.listener||r]:[r]:n?jt(r):ct(r,r.length)}m.prototype.listeners=function(e){return st(this,e,!0)},m.prototype.rawListeners=function(e){return st(this,e,!1)},m.listenerCount=function(e,t){return typeof e.listenerCount=="function"?e.listenerCount(t):ot.call(e,t)},m.prototype.listenerCount=ot;function ot(e){var t=this._events;if(t!==void 0){var n=t[e];if(typeof n=="function")return 1;if(n!==void 0)return n.length}return 0}m.prototype.eventNames=function(){return this._eventsCount>0?xe(this._events):[]};function ct(e,t){for(var n=new Array(t),i=0;i<t;++i)n[i]=e[i];return n}function Ut(e,t){for(;t+1<e.length;t++)e[t]=e[t+1];e.pop()}function jt(e){for(var t=new Array(e.length),n=0;n<t.length;++n)t[n]=e[n].listener||e[n];return t}function Dt(e,t){return new Promise(function(n,i){function r(l){e.removeListener(t,s),i(l)}function s(){typeof e.removeListener=="function"&&e.removeListener("error",r),n([].slice.call(arguments))}at(e,t,s,{once:!0}),t!=="error"&&Wt(e,r,{once:!0})})}function Wt(e,t,n){typeof e.on=="function"&&at(e,"error",t,n)}function at(e,t,n,i){if(typeof e.on=="function")i.once?e.once(t,n):e.on(t,n);else if(typeof e.addEventListener=="function")e.addEventListener(t,function r(s){i.once&&e.removeEventListener(t,r),n(s)});else throw new TypeError('The "emitter" argument must be of type EventEmitter. Received type '+typeof e)}var Nt=je.exports;const Se="pc-uploader-iframe-wrapper",De="pc-uploader-iframe";class Rt{constructor(t){if(R(this,q),R(this,Oe),R(this,Ue),R(this,re,void 0),R(this,J,void 0),R(this,V,void 0),R(this,se,void 0),R(this,oe,void 0),R(this,ce,void 0),X(this,re,t.token),X(this,J,t.sideId||t.productId),X(this,ce,t.productId?"product":"side"),X(this,V,t.uploaderUrl?t.uploaderUrl:"https://upload-tool.pages.dev"),X(this,se,new Nt),X(this,oe,t.locale),!T(this,re)||!T(this,J)){console.warn("Missing Config Params.");return}F(this,Oe,Ye).call(this),F(this,Ue,Ge).call(this)}get locale(){return T(this,oe)}open(){let t=document.getElementById(Se),n=document.getElementById(De);const i=new URL(T(this,V));if(i.searchParams.set("token",T(this,re)),T(this,ce)==="side"?i.searchParams.set("sideId",T(this,J)):T(this,ce)==="product"&&i.searchParams.set("productId",T(this,J)),i.searchParams.set("parentUrl",window.location.href),!n||!(n instanceof HTMLIFrameElement)||!t){console.warn("Can not find iframe element.");return}n.src=i.href,t.style.opacity="1",t.style.visibility="visible",F(this,q,Z).call(this,"open")}close(){let t=document.getElementById(Se);if(!t){console.error("Can not find iframe element");return}t.style.opacity="0",t.style.visibility="hidden"}on(t,n){return T(this,se).on(t,n),this}}re=new WeakMap,J=new WeakMap,V=new WeakMap,se=new WeakMap,oe=new WeakMap,ce=new WeakMap,q=new WeakSet,Z=function(e,...t){T(this,se).emit(e,...t)},Oe=new WeakSet,Ye=function(){let e=document.createElement("div");e.id=Se,e.style.cssText="position:fixed;top:0;left:0;width:100vw;height:100vh;opacity:0;visibility:hidden;z-index:99999";let t=document.createElement("iframe");t.id=De,t.width="100%",t.height="100%",t.style.borderWidth="0",e.appendChild(t),document.body.appendChild(e)},Ue=new WeakSet,Ge=function(){let e=document.getElementById(Se);window.addEventListener("message",t=>{var n;const i=new URL(t.origin),r=new URL(T(this,V));if(i.host===r.host){t.data.uploaderEvent==="close"&&e&&(e.style.opacity="0",e.style.visibility="hidden",F(this,q,Z).call(this,"close")),t.data.uploaderEvent==="upload-success"&&F(this,q,Z).call(this,"upload-success",t.data.data),t.data.uploaderEvent==="upload-error"&&F(this,q,Z).call(this,"upload-error",t.data.error);const s=T(this,oe),l=document.getElementById(De);l&&l instanceof HTMLIFrameElement&&(F(this,q,Z).call(this,"onload"),s&&t.data.uploaderEvent==="loaded"&&t.data.finished&&(console.log("test"),l.focus(),(n=l.contentWindow)==null||n.postMessage({locale:s},T(this,V))))}},!1)};class Bt{constructor(){o(this,"initDesignTool",t=>new Tt(t)),o(this,"initUploader",t=>new Rt(t))}}return Bt}();var w="";const I=new y;class le{constructor(){E(this,ee);E(this,te);E(this,de);E(this,pe);E(this,B);E(this,ue);E(this,he);E(this,fe);E(this,me);E(this,ve);E(this,ge);E(this,ye);E(this,we);E(this,be);E(this,_e);E(this,Ee);E(this,Le);E(this,z,void 0);A(this,"token");A(this,"appID");A(this,"productIdPC");A(this,"orderIdWix");A(this,"orderNumberWix");A(this,"options");E(this,Q,void 0);E(this,k,void 0);E(this,P,void 0);E(this,D,void 0);A(this,"registerListener");this.token=g(this,ye,gt).call(this),this.productIdPC=null,this.appID="325c68a5-64c2-440d-b093-8cea369df06b",this.orderIdWix=null,this.orderNumberWix=null,$(this,D,null),this.options=window.PrintcartDesignerShopifyOptions,$(this,z,"https://api.printcart.com/v1"),$(this,Q,"https://customizer.printcart.com")}init(){const c=window,o=this;c!=null&&c.wixDevelopersAnalytics?g(this,ee,Re).call(this,"first"):c.addEventListener("wixDevelopersAnalyticsReady",function(){var a;g(a=o,ee,Re).call(a,"second")})}}z=new WeakMap,Q=new WeakMap,k=new WeakMap,P=new WeakMap,D=new WeakMap,ee=new WeakSet,Re=function(c){const o=this;console.log("Printcart start App "+c),window==null||window.wixDevelopersAnalytics.register(this.appID,function(d,p){var v,L,b;switch(d){case"ViewContent":localStorage.getItem("pc-product")&&localStorage.removeItem("pc-product");break;case"productPageLoaded":if(console.log("Printcart: productPageLoaded",p),p.variants&&p.variants.length>1)return;g(v=o,te,Be).call(v,p==null?void 0:p.productId);break;case"CustomizeProduct":if(p.variants&&p.variants.length<1)return;g(L=o,te,Be).call(L,p==null?void 0:p.variantId);break;case"Purchase":if(!localStorage.getItem("pc-design-ids"))return;const C=localStorage.getItem("pc-design-ids");if(o.orderIdWix=p==null?void 0:p.orderId,o.orderNumberWix=p==null?void 0:p.id,!o.orderIdWix)throw new Error("Can not find order ID WIX");if(!o.orderNumberWix)throw new Error("Can not find order number WIX");if(!C)throw new Error("Can not find design Ids");g(b=o,Le,Et).call(b,o.orderNumberWix,o.orderIdWix,JSON.parse(C));break}})},te=new WeakSet,Be=function(c){if($(this,D,document.querySelector("[data-hook='product-options']")),!u(this,D))throw new Error("This script can only be used inside a Wix Product Page.");if(!c)throw new Error("Can not find product ID WIX");g(this,_e,bt).call(this,c).then(o=>{var L,b;if(this.productIdPC=(L=o==null?void 0:o.data)==null?void 0:L.id,!this.productIdPC)throw new Error("Can not find product ID Printcart");g(this,be,wt).call(this),g(this,Ee,_t).call(this),g(this,de,lt).call(this),g(this,ue,pt).call(this),g(this,he,ut).call(this);const a=document.querySelector("button#pc-btn"),d=o.data.enable_design,p=o.data.enable_upload;d&&($(this,k,I.initDesignTool({token:this.token,productId:this.productIdPC,options:{...(b=this.options)==null?void 0:b.designerOptions,designerUrl:u(this,Q)}})),g(this,ge,vt).call(this),a&&a instanceof HTMLButtonElement&&(a.disabled=!1)),p&&($(this,P,I.initUploader({token:this.token,productId:this.productIdPC})),g(this,ve,mt).call(this),a&&a instanceof HTMLButtonElement&&(a.disabled=!1));const v=C=>{C.preventDefault(),u(this,k)&&!u(this,P)&&u(this,k).render(),!u(this,k)&&u(this,P)&&u(this,P).open(),u(this,k)&&u(this,P)&&g(this,pe,dt).call(this)};a&&a instanceof HTMLButtonElement&&(a.onclick=v)})},de=new WeakSet,lt=function(){const a='<button aria-label="Close" id="pc-select_close-btn"><span data-modal-x></span></button><div class="pc-select-wrap" id="pc-content-overlay"><div class="pc-select-inner"><div id="pc-select_header">Choose a way to design this product</div><div id="pc-select_container"><button class="pc-select_btn" id="pc-select_btn_upload"><div aria-hidden="true" class="pc-select_btn_wrap"><div class="pc-select_btn_img"><div class="pc-select_btn_img_inner"><img src="https://files.printcart.com/common/upload.svg" alt="Printcart Uploader"></div></div><div class="pc-select_btn_content"><div class="pc-select_btn_content_inner"><h2 class="pc-title">Upload a full design</h2><ul><li>Have a complete design</li><li>Have your own designer</li></ul></div></div></div><div class="visually-hidden">Upload Design file</div></button><button class="pc-select_btn" id="pc-select_btn_design"><div aria-hidden="true" class="pc-select_btn_wrap"><div class="pc-select_btn_img"><div class="pc-select_btn_img_inner"><img src="https://files.printcart.com/common/design.svg" alt="Printcart Designer"></div></div><div class="pc-select_btn_content"><div class="pc-select_btn_content_inner"><h2 class="pc-title">Design here online</h2><ul><li>Already have your concept</li><li>Customize every details</li></ul></div></div></div><div class="visually-hidden">Upload Design file</div></button></div></div></div>',d=document.createElement("div");d.id="pc-select_wrap",d.setAttribute("role","dialog"),d.setAttribute("aria-modal","true"),d.setAttribute("tabIndex","-1"),d.innerHTML=a,document.body.appendChild(d);const p=()=>{u(this,k)&&(g(this,B,G).call(this),u(this,k).render(),document.body.classList.add("pc-overflow"))},v=()=>{u(this,P)&&(g(this,B,G).call(this),u(this,P).open(),document.body.classList.add("pc-overflow"))},L=document.getElementById("pc-select_btn_upload"),b=document.getElementById("pc-select_btn_design");L&&(L==null||L.addEventListener("click",v)),b&&(b==null||b.addEventListener("click",p))},pe=new WeakSet,dt=function(){const c=document.getElementById("pc-select_wrap");c&&(c.style.display="flex",document.body.classList.add("pc-overflow"));const o=c==null?void 0:c.querySelector("#pc-select_close-btn");o&&o instanceof HTMLButtonElement&&o.focus()},B=new WeakSet,G=function(){const c=document.getElementById("pc-select_wrap");c&&(c.style.display="none"),document.body.classList.remove("pc-overflow")},ue=new WeakSet,pt=function(){const c=document.getElementById("pc-select_close-btn"),o=document.getElementById("pc-content-overlay"),a=d=>{d.key==="Escape"&&g(this,B,G).call(this)};window.addEventListener("keydown",a),c==null||c.addEventListener("click",()=>g(this,B,G).call(this)),o==null||o.addEventListener("click",()=>{const d=document.getElementById("pc-designer-iframe-wrapper");(d==null?void 0:d.style.visibility)!=="visible"&&g(this,B,G).call(this)})},he=new WeakSet,ut=function(){const c=document.getElementById("pc-select_wrap"),o=c==null?void 0:c.querySelectorAll("button"),a=o&&o[0],d=o&&o[o.length-1],p=v=>{v.key==="Tab"&&(v.shiftKey?d&&document.activeElement===a&&(d.focus(),v.preventDefault()):a&&document.activeElement===d&&(a.focus(),v.preventDefault()))};window.addEventListener("keydown",p)},fe=new WeakSet,ht=function(c){var L,b;const o=c.map(C=>C.data.id);let a=document.querySelector('input[name="properties[_pcDesignIds]"]');a?a.value+=`,${o.join()}`:(a=document.createElement("input"),a.type="hidden",a.name="properties[_pcDesignIds]",a.className="pc-designer_input",a.value=o.join(),(L=u(this,D))==null||L.appendChild(a));const d=document.querySelector(".pc-preview-wrap")||document.createElement("div");d.className="pc-preview-wrap",localStorage.getItem("pc-design-ids")&&localStorage.removeItem("pc-design-ids"),localStorage.setItem("pc-design-ids",JSON.stringify(o)),c.forEach(C=>{var W;if(!C.data.design_image.url)return;const h=document.createElement("div");h.className="pc-preview",h.setAttribute("data-pc-design-id",C.data.id);const x=document.createElement("button");x.className="pc-btn pc-danger-btn",x.innerHTML=(W=this.options)!=null&&W.removeUploaderBtnText?this.options.removeUploaderBtnText:"Remove",x.onclick=U=>{U.preventDefault();const H=a.value.split(",").filter(j=>j!==C.data.id);a.value=H.join(),h.remove()};const S=document.createElement("img");S.src=C.data.design_image.url,S.className="pc-uploader-image";const M=document.createElement("div");M.className="pc-preview-overlay",M.appendChild(x),h.appendChild(M),h.appendChild(S),d.appendChild(h)});const p=document.querySelector("div#pc-designer_wrap");if(!document.querySelector(".princart-preview-heading")){const C=document.createElement("h5");C.className="princart-preview-heading",C.innerHTML="Your artworks",p==null||p.appendChild(C)}p==null||p.appendChild(d);const v=(b=this.options)==null?void 0:b.onUploadSuccess;v&&v(c,u(this,P))},me=new WeakSet,ft=function(c){var b,C;const o=this,a=c.map(h=>h.id);let d=document.querySelector('input[name="properties[_pcDesignIds]"]');d?d.value+=`,${a.join()}`:(d=document.createElement("input"),d.type="hidden",d.name="properties[_pcDesignIds]",d.className="pc-designer_input",d.value=a.join(),(b=u(this,D))==null||b.appendChild(d));const p=document.querySelector(".pc-preview-wrap")||document.createElement("div");p.className="pc-preview-wrap",localStorage.getItem("pc-design-ids")&&localStorage.removeItem("pc-design-ids"),localStorage.setItem("pc-design-ids",JSON.stringify(a)),c.forEach(h=>{var H;if(!h.design_image.url)return;const x=document.createElement("div");x.className="pc-preview",x.setAttribute("data-pc-design-id",h.id);const S=document.createElement("button");S.className="pc-btn pc-primary-btn",S.style.borderRadius="5px",S.innerHTML="Edit",S.onclick=j=>{j.preventDefault(),u(o,k).editDesign(h.id)};const M=document.createElement("button");M.className="pc-btn pc-danger-btn",M.style.borderRadius="5px",M.innerHTML="Remove",M.onclick=j=>{j.preventDefault();const ne=d.value.split(",").filter(O=>O!==h.id);d.value=ne.join(),x.remove()};const W=document.createElement("img");W.src=((H=h.preview_image)==null?void 0:H.url)||h.design_image.url,W.className="pc-uploader-image";const U=document.createElement("div");U.className="pc-preview-overlay",U.appendChild(S),U.appendChild(M),x.appendChild(U),x.appendChild(W),p.appendChild(x)});const v=document.querySelector("div#pc-designer_wrap");v==null||v.appendChild(p);const L=(C=this.options)==null?void 0:C.onDesignCreateSuccess;L&&L(c,u(this,k))},ve=new WeakSet,mt=function(){u(this,P)&&(u(this,P).on("upload-success",c=>{g(this,fe,ht).call(this,c),u(this,P).close()}),u(this,P).on("close",()=>{document.body.classList.remove("pc-overflow")}))},ge=new WeakSet,vt=function(){u(this,k)&&(u(this,k).on("upload-success",c=>{g(this,me,ft).call(this,c),u(this,k).close()}),u(this,k).on("closed",()=>{document.body.classList.remove("pc-overflow")}),u(this,k).on("edit-success",c=>{var d;if(!c.design_image.url)return;const o=document.querySelector(`[data-pc-design-id="${c.id}"] img`);if(!o||!(o instanceof HTMLImageElement))throw new Error("Can't find image element");o.src=c.design_image.url;const a=(d=this.options)==null?void 0:d.onDesignEditSuccess;u(this,k).close(),a&&a(c,u(this,k))}))},ye=new WeakSet,gt=function(){const c=g(this,we,yt).call(this),o=new URL(c);return new URLSearchParams(o.search).get("shopT")},we=new WeakSet,yt=function(){return document.querySelector("[id='pc-wix-integration-sdk']").src},be=new WeakSet,wt=function(){const c="https://unpkg.com/@printcart/wix-integration/dist",o=document.createElement("link");o.rel="stylesheet",o.href=`${c}/style.css`,document.head.appendChild(o)},_e=new WeakSet,bt=async function(c){try{const o=`${u(this,z)}/integration/wix/products/${c}`,a=this.token;if(!a)throw new Error("Missing Printcart Unauth Token");return await(await fetch(o,{headers:{"X-PrintCart-Unauth-Token":a}})).json()}catch(o){console.error("There has been a problem with your fetch operation:",o);return}},Ee=new WeakSet,_t=function(){var d,p,v;const c=u(this,D);if(!(c!=null&&c.parentNode)){console.log("Can not find cart form");return}if(document.getElementById("pc-designer_wrap")!==null)return;const o=document.createElement("div");o.id="pc-designer_wrap";const a=document.createElement("button");a.id="pc-btn",a.className=(d=this.options)!=null&&d.designClassName?(p=this.options)==null?void 0:p.designClassName:"",a.innerHTML=(v=this.options)!=null&&v.designBtnText?this.options.designBtnText:"Start Design",a.disabled=!0,o.appendChild(a),c.appendChild(o)},Le=new WeakSet,Et=async function(c,o,a){try{const d=`${u(this,z)}/projects`,p=this.token;if(!p)throw new Error("Missing Printcart Unauth Token");const v={name:`${c}`,status:"processing",design_ids:a,order_detail:{id:o}};await fetch(d,{method:"POST",headers:{"Content-Type":"application/json","X-PrintCart-Unauth-Token":p},body:JSON.stringify(v)})}catch(d){console.error("There has been a problem with your fetch operation:",d);return}},new le().init()})();

@@ -7,3 +7,3 @@ {

],
"version": "1.1.12",
"version": "1.1.13",
"scripts": {

@@ -10,0 +10,0 @@ "dev": "vite --port 3102",

SocketSocket SOC 2 Logo

Product

  • Package Alerts
  • Integrations
  • Docs
  • Pricing
  • FAQ
  • Roadmap
  • Changelog

Packages

npm

Stay in touch

Get open source security insights delivered straight into your inbox.


  • Terms
  • Privacy
  • Security

Made with ⚡️ by Socket Inc