Plugin Directory

Changeset 3135163


Ignore:
Timestamp:
08/13/2024 09:53:05 PM (19 months ago)
Author:
mewz
Message:

Release v2.0.3

Location:
attribute-stock-for-woocommerce/trunk
Files:
24 edited

Legend:

Unmodified
Added
Removed
  • attribute-stock-for-woocommerce/trunk/assets/dist/admin/stock-edit.js

    r3110100 r3135163  
    6565  const $this = $('#mewz_wcas_internal');
    6666  const internal = $this.prop('checked') || $this.prop('disabled');
     67  $('#mewz_wcas_product_sku').prop('disabled', internal);
    6768  $('#mewz_wcas_product_image').prop('disabled', internal);
    6869}
  • attribute-stock-for-woocommerce/trunk/assets/dist/admin/stock-edit.min.js

    r3110100 r3135163  
    1 (()=>{"use strict";(()=>{let t=!1;function e(e){e&&!t||jQuery(document.body).trigger("wc-enhanced-select-init")}function n(t){jQuery(t).tipTip({fadeIn:50,fadeOut:50,delay:200})}function o(t,e,n){const o=t.closest("form");o?setTimeout((()=>{const t=i(o,e);o.addEventListener("submit",(()=>{const s=i(o,e)!==t;n(s)}))}),300):n(!0)}function i(t,e){const n=new FormData(t),o=[];for(const t of n.entries())t[0].startsWith(e)&&o.push(t[0],t[1]);return JSON.stringify(o)}jQuery(document.body).one("wc-enhanced-select-init",(()=>{t=!0}));const s=jQuery;function r(){const t=s("#mewz_wcas_internal"),e=t.prop("checked")||t.prop("disabled");s("#mewz_wcas_product_image").prop("disabled",e)}const l=jQuery,a=window.mewzWcas&&mewzWcas.headerActions||{},c=jQuery;let u;function d(t,e){const n=u.querySelector(`.wc-tabs > .${t}_tab a`);n&&(e?n.dataset.indicator=e:delete n.dataset.indicator)}function p(t){const e=c(`#${t}_panel`);e.on("change input",(()=>{f(t,e)})),f(t,e)}function f(t,e){const n=e.find(":input:not(:disabled, .select2-search__field)");let o=0;n.each((function(){const t=c(this),e="checkbox"===t.attr("type")?t.prop("checked"):t.val();Array.isArray(e)?o+=e.length:e&&o++})),d(t,o)}function h(){}const m=t=>t;function $(t,e){for(const n in e)t[n]=e[n];return t}function g(t){return t()}function b(){return Object.create(null)}function v(t){t.forEach(g)}function y(t){return"function"==typeof t}function w(t,e){return t!=t?e==e:t!==e||t&&"object"==typeof t||"function"==typeof t}function _(t,e){return t!=t?e==e:t!==e}function x(t){const e={};for(const n in t)"$"!==n[0]&&(e[n]=t[n]);return e}function k(t){return t&&y(t.destroy)?t.destroy:h}const E="undefined"!=typeof window;let L=E?()=>window.performance.now():()=>Date.now(),T=E?t=>requestAnimationFrame(t):h;const z=new Set;function A(t){z.forEach((e=>{e.c(t)||(z.delete(e),e.f())})),0!==z.size&&T(A)}function M(t){let e;return 0===z.size&&T(A),{promise:new Promise((n=>{z.add(e={c:t,f:n})})),abort(){z.delete(e)}}}const O="undefined"!=typeof window?window:"undefined"!=typeof globalThis?globalThis:global;class C{_listeners="WeakMap"in O?new WeakMap:void 0;_observer=void 0;options;constructor(t){this.options=t}observe(t,e){return this._listeners.set(t,e),this._getObserver().observe(t,this.options),()=>{this._listeners.delete(t),this._observer.unobserve(t)}}_getObserver(){return this._observer??(this._observer=new ResizeObserver((t=>{for(const e of t)C.entries.set(e.target,e),this._listeners.get(e.target)?.(e)})))}}C.entries="WeakMap"in O?new WeakMap:void 0;let I=!1;function S(t,e){t.appendChild(e)}function j(t){if(!t)return document;const e=t.getRootNode?t.getRootNode():t.ownerDocument;return e&&e.host?e:t.ownerDocument}function W(t){const e=R("style");return e.textContent="/* empty */",function(t,e){S(t.head||t,e),e.sheet}(j(t),e),e.sheet}function N(t,e,n){t.insertBefore(e,n||null)}function P(t){t.parentNode&&t.parentNode.removeChild(t)}function R(t){return document.createElement(t)}function q(t){return document.createTextNode(t)}function F(){return q(" ")}function Y(t,e,n,o){return t.addEventListener(e,n,o),()=>t.removeEventListener(e,n,o)}function X(t,e,n){null==n?t.removeAttribute(e):t.getAttribute(e)!==n&&t.setAttribute(e,n)}function B(t){return""===t?null:+t}function D(t,e){e=""+e,t.data!==e&&(t.data=e)}function H(t,e){t.value=null==e?"":e}function Q(t,e,n){t.classList.toggle(e,!!n)}function J(t,e,{bubbles:n=!1,cancelable:o=!1}={}){return new CustomEvent(t,{detail:e,bubbles:n,cancelable:o})}const U=new Map;let V,G=0;function K(t,e,n,o,i,s,r,l=0){const a=16.666/o;let c="{\n";for(let t=0;t<=1;t+=a){const o=e+(n-e)*s(t);c+=100*t+`%{${r(o,1-o)}}\n`}const u=c+`100% {${r(n,1-n)}}\n}`,d=`__svelte_${function(t){let e=5381,n=t.length;for(;n--;)e=(e<<5)-e^t.charCodeAt(n);return e>>>0}(u)}_${l}`,p=j(t),{stylesheet:f,rules:h}=U.get(p)||function(t,e){const n={stylesheet:W(e),rules:{}};return U.set(t,n),n}(p,t);h[d]||(h[d]=!0,f.insertRule(`@keyframes ${d} ${u}`,f.cssRules.length));const m=t.style.animation||"";return t.style.animation=`${m?`${m}, `:""}${d} ${o}ms linear ${i}ms 1 both`,G+=1,d}function Z(t,e){const n=(t.style.animation||"").split(", "),o=n.filter(e?t=>t.indexOf(e)<0:t=>-1===t.indexOf("__svelte")),i=n.length-o.length;i&&(t.style.animation=o.join(", "),G-=i,G||T((()=>{G||(U.forEach((t=>{const{ownerNode:e}=t.stylesheet;e&&P(e)})),U.clear())})))}function tt(t){V=t}function et(){if(!V)throw new Error("Function called outside component initialization");return V}function nt(t){et().$$.on_mount.push(t)}function ot(){const t=et();return(e,n,{cancelable:o=!1}={})=>{const i=t.$$.callbacks[e];if(i){const s=J(e,n,{cancelable:o});return i.slice().forEach((e=>{e.call(t,s)})),!s.defaultPrevented}return!0}}function it(t,e){return et().$$.context.set(t,e),e}function st(t){return et().$$.context.get(t)}const rt=[],lt=[];let at=[];const ct=[],ut=Promise.resolve();let dt=!1;function pt(t){at.push(t)}function ft(t){ct.push(t)}const ht=new Set;let mt,$t=0;function gt(){if(0!==$t)return;const t=V;do{try{for(;$t<rt.length;){const t=rt[$t];$t++,tt(t),bt(t.$$)}}catch(t){throw rt.length=0,$t=0,t}for(tt(null),rt.length=0,$t=0;lt.length;)lt.pop()();for(let t=0;t<at.length;t+=1){const e=at[t];ht.has(e)||(ht.add(e),e())}at.length=0}while(rt.length);for(;ct.length;)ct.pop()();dt=!1,ht.clear(),tt(t)}function bt(t){if(null!==t.fragment){t.update(),v(t.before_update);const e=t.dirty;t.dirty=[-1],t.fragment&&t.fragment.p(t.ctx,e),t.after_update.forEach(pt)}}function vt(){return mt||(mt=Promise.resolve(),mt.then((()=>{mt=null}))),mt}function yt(t,e,n){t.dispatchEvent(J(`${e?"intro":"outro"}${n}`))}const wt=new Set;let _t;function xt(){_t={r:0,c:[],p:_t}}function kt(){_t.r||v(_t.c),_t=_t.p}function Et(t,e){t&&t.i&&(wt.delete(t),t.i(e))}function Lt(t,e,n,o){if(t&&t.o){if(wt.has(t))return;wt.add(t),_t.c.push((()=>{wt.delete(t),o&&(n&&t.d(1),o())})),t.o(e)}else o&&o()}const Tt={duration:0};function zt(t,e,n,o){let i,s=e(t,n,{direction:"both"}),r=o?0:1,l=null,a=null,c=null;function u(){c&&Z(t,c)}function d(t,e){const n=t.b-r;return e*=Math.abs(n),{a:r,b:t.b,d:n,duration:e,start:t.start,end:t.start+e,group:t.group}}function p(e){const{delay:n=0,duration:o=300,easing:p=m,tick:f=h,css:$}=s||Tt,g={start:L()+n,b:e};e||(g.group=_t,_t.r+=1),"inert"in t&&(e?void 0!==i&&(t.inert=i):(i=t.inert,t.inert=!0)),l||a?a=g:($&&(u(),c=K(t,r,e,o,n,p,$)),e&&f(0,1),l=d(g,o),pt((()=>yt(t,e,"start"))),M((e=>{if(a&&e>a.start&&(l=d(a,o),a=null,yt(t,l.b,"start"),$&&(u(),c=K(t,r,l.b,l.duration,0,p,s.css))),l)if(e>=l.end)f(r=l.b,1-r),yt(t,l.b,"end"),a||(l.b?u():--l.group.r||v(l.group.c)),l=null;else if(e>=l.start){const t=e-l.start;r=l.a+l.d*p(t/l.duration),f(r,1-r)}return!(!l&&!a)})))}return{run(t){y(s)?vt().then((()=>{s=s({direction:t?"in":"out"}),p(t)})):p(t)},end(){u(),l=a=null}}}function At(t){return void 0!==t?.length?t:Array.from(t)}function Mt(t,e){t.d(1),e.delete(t.key)}function Ot(t,e){Lt(t,1,1,(()=>{e.delete(t.key)}))}function Ct(t,e,n,o,i,s,r,l,a,c,u,d){let p=t.length,f=s.length,h=p;const m={};for(;h--;)m[t[h].key]=h;const $=[],g=new Map,b=new Map,y=[];for(h=f;h--;){const t=d(i,s,h),l=n(t);let a=r.get(l);a?o&&y.push((()=>a.p(t,e))):(a=c(l,t),a.c()),g.set(l,$[h]=a),l in m&&b.set(l,Math.abs(h-m[l]))}const w=new Set,_=new Set;function x(t){Et(t,1),t.m(l,u),r.set(t.key,t),u=t.first,f--}for(;p&&f;){const e=$[f-1],n=t[p-1],o=e.key,i=n.key;e===n?(u=e.first,p--,f--):g.has(i)?!r.has(o)||w.has(o)?x(e):_.has(i)?p--:b.get(o)>b.get(i)?(_.add(o),x(e)):(w.add(i),p--):(a(n,r),p--)}for(;p--;){const e=t[p];g.has(e.key)||a(e,r)}for(;f;)x($[f-1]);return v(y),$}let It;function St(t,e,n){const o=t.$$.props[e];void 0!==o&&(t.$$.bound[o]=n,n(t.$$.ctx[o]))}function jt(t){t&&t.c()}function Wt(t,e,n){const{fragment:o,after_update:i}=t.$$;o&&o.m(e,n),pt((()=>{const e=t.$$.on_mount.map(g).filter(y);t.$$.on_destroy?t.$$.on_destroy.push(...e):v(e),t.$$.on_mount=[]})),i.forEach(pt)}function Nt(t,e){const n=t.$$;null!==n.fragment&&(function(t){const e=[],n=[];at.forEach((o=>-1===t.indexOf(o)?e.push(o):n.push(o))),n.forEach((t=>t())),at=e}(n.after_update),v(n.on_destroy),n.fragment&&n.fragment.d(e),n.on_destroy=n.fragment=null,n.ctx=[])}function Pt(t,e,n,o,i,s,r=null,l=[-1]){const a=V;tt(t);const c=t.$$={fragment:null,ctx:[],props:s,update:h,not_equal:i,bound:b(),on_mount:[],on_destroy:[],on_disconnect:[],before_update:[],after_update:[],context:new Map(e.context||(a?a.$$.context:[])),callbacks:b(),dirty:l,skip_bound:!1,root:e.target||a.$$.root};r&&r(c.root);let u=!1;if(c.ctx=n?n(t,e.props||{},((e,n,...o)=>{const s=o.length?o[0]:n;return c.ctx&&i(c.ctx[e],c.ctx[e]=s)&&(!c.skip_bound&&c.bound[e]&&c.bound[e](s),u&&function(t,e){-1===t.$$.dirty[0]&&(rt.push(t),dt||(dt=!0,ut.then(gt)),t.$$.dirty.fill(0)),t.$$.dirty[e/31|0]|=1<<e%31}(t,e)),n})):[],c.update(),u=!0,v(c.before_update),c.fragment=!!o&&o(c.ctx),e.target){if(e.hydrate){I=!0;const t=(d=e.target,Array.from(d.childNodes));c.fragment&&c.fragment.l(t),t.forEach(P)}else c.fragment&&c.fragment.c();e.intro&&Et(t.$$.fragment),Wt(t,e.target,e.anchor),I=!1,gt()}var d;tt(a)}function Rt(t,e,n,o){const i=n[t]?.type;if(e="Boolean"===i&&"boolean"!=typeof e?null!=e:e,!o||!n[t])return e;if("toAttribute"===o)switch(i){case"Object":case"Array":return null==e?null:JSON.stringify(e);case"Boolean":return e?"":null;case"Number":return null==e?null:e;default:return e}else switch(i){case"Object":case"Array":return e&&JSON.parse(e);case"Boolean":default:return e;case"Number":return null!=e?+e:e}}new Set(["allowfullscreen","allowpaymentrequest","async","autofocus","autoplay","checked","controls","default","defer","disabled","formnovalidate","hidden","inert","ismap","loop","multiple","muted","nomodule","novalidate","open","playsinline","readonly","required","reversed","selected"]),"function"==typeof HTMLElement&&(It=class extends HTMLElement{$$ctor;$$s;$$c;$$cn=!1;$$d={};$$r=!1;$$p_d={};$$l={};$$l_u=new Map;constructor(t,e,n){super(),this.$$ctor=t,this.$$s=e,n&&this.attachShadow({mode:"open"})}addEventListener(t,e,n){if(this.$$l[t]=this.$$l[t]||[],this.$$l[t].push(e),this.$$c){const n=this.$$c.$on(t,e);this.$$l_u.set(e,n)}super.addEventListener(t,e,n)}removeEventListener(t,e,n){if(super.removeEventListener(t,e,n),this.$$c){const t=this.$$l_u.get(e);t&&(t(),this.$$l_u.delete(e))}}async connectedCallback(){if(this.$$cn=!0,!this.$$c){if(await Promise.resolve(),!this.$$cn||this.$$c)return;function t(t){return()=>{let e;return{c:function(){e=R("slot"),"default"!==t&&X(e,"name",t)},m:function(t,n){N(t,e,n)},d:function(t){t&&P(e)}}}}const e={},n=function(t){const e={};return t.childNodes.forEach((t=>{e[t.slot||"default"]=!0})),e}(this);for(const i of this.$$s)i in n&&(e[i]=[t(i)]);for(const s of this.attributes){const r=this.$$g_p(s.name);r in this.$$d||(this.$$d[r]=Rt(r,s.value,this.$$p_d,"toProp"))}for(const l in this.$$p_d)l in this.$$d||void 0===this[l]||(this.$$d[l]=this[l],delete this[l]);this.$$c=new this.$$ctor({target:this.shadowRoot||this,props:{...this.$$d,$$slots:e,$$scope:{ctx:[]}}});const o=()=>{this.$$r=!0;for(const t in this.$$p_d)if(this.$$d[t]=this.$$c.$$.ctx[this.$$c.$$.props[t]],this.$$p_d[t].reflect){const e=Rt(t,this.$$d[t],this.$$p_d,"toAttribute");null==e?this.removeAttribute(this.$$p_d[t].attribute||t):this.setAttribute(this.$$p_d[t].attribute||t,e)}this.$$r=!1};this.$$c.$$.after_update.push(o),o();for(const a in this.$$l)for(const c of this.$$l[a]){const u=this.$$c.$on(a,c);this.$$l_u.set(c,u)}this.$$l={}}}attributeChangedCallback(t,e,n){this.$$r||(t=this.$$g_p(t),this.$$d[t]=Rt(t,n,this.$$p_d,"toProp"),this.$$c?.$set({[t]:this.$$d[t]}))}disconnectedCallback(){this.$$cn=!1,Promise.resolve().then((()=>{!this.$$cn&&this.$$c&&(this.$$c.$destroy(),this.$$c=void 0)}))}$$g_p(t){return Object.keys(this.$$p_d).find((e=>this.$$p_d[e].attribute===t||!this.$$p_d[e].attribute&&e.toLowerCase()===t))||t}});class qt{$$=void 0;$$set=void 0;$destroy(){Nt(this,1),this.$destroy=h}$on(t,e){if(!y(e))return h;const n=this.$$.callbacks[t]||(this.$$.callbacks[t]=[]);return n.push(e),()=>{const t=n.indexOf(e);-1!==t&&n.splice(t,1)}}$set(t){var e;this.$$set&&(e=t,0!==Object.keys(e).length)&&(this.$$.skip_bound=!0,this.$$set(t),this.$$.skip_bound=!1)}}function Ft(t){const e=t-1;return e*e*e+1}function Yt(t,{delay:e=0,duration:n=200,easing:o=Ft,side:i="bottom"}){if(n<=0)return!1;const s=getComputedStyle(t),r=t.offsetHeight;if(r<=0)return!1;let l;switch(i){case"top":l=[s.marginTop,s.marginBottom];break;case"bottom":l=[s.marginBottom,s.marginTop];break;case"left":l=[s.marginLeft,s.marginRight];break;case"right":l=[s.marginRight,s.marginLeft];break;default:return!1}l[0]=parseFloat(l[0])||0,l[1]=parseFloat(l[1])||0;const a=r+l[0]+l[1];return{delay:e,duration:n,easing:o,css:function(t,e){const n=l[0]-a*e;return`margin-${i}: ${n}px; opacity: ${t}; z-index: 0;`}}}function Xt(t){let e;return{c(){e=R("select"),X(e,"name",t[0]),e.multiple=t[1],e.disabled=t[2]},m(n,o){N(n,e,o),t[8](e)},p(t,[n]){1&n&&X(e,"name",t[0]),2&n&&(e.multiple=t[1]),4&n&&(e.disabled=t[2])},i:h,o:h,d(n){n&&P(e),t[8](null)}}}function Bt(t,n,o){let{handler:i}=n,{name:s=null}=n,{data:r=[]}=n,{multiple:l=!1}=n,{disabled:a=!1}=n,{placeholder:c=null}=n,{options:u={}}=n;const d=ot();let p,f=!1;var h;return nt((()=>{if(o(4,i=jQuery(p)),i.addClass("wc-enhanced-select"),i.data("data",r),i.data("placeholder",c),i.data("width","resolve"),u&&i.data(u),!1!==u.init&&e(!0!==u.init),i.on("change",(t=>{d("change",{handler:i,event:t})})),i.on("select2:close",(()=>{i.data("select2").$container.removeClass("select2-container--above"),i.data("select2").$dropdown.find("> .select2-dropdown").removeClass("select2-dropdown--above")})),l||i.on("select2:open",(()=>{const t=i.data("select2").$dropdown.find(".select2-search__field");t.one("blur",(()=>{setTimeout((()=>t.focus()),10)}))})),u.fixPosition){let t=!1;i.on("select2:open",(()=>{t||(i.selectWoo("close"),t=!0,i.selectWoo("open"),t=!1)}))}setTimeout((()=>{f=!0}))})),h=()=>{i.selectWoo("destroy"),i.remove()},et().$$.on_destroy.push(h),t.$$set=t=>{"handler"in t&&o(4,i=t.handler),"name"in t&&o(0,s=t.name),"data"in t&&o(5,r=t.data),"multiple"in t&&o(1,l=t.multiple),"disabled"in t&&o(2,a=t.disabled),"placeholder"in t&&o(6,c=t.placeholder),"options"in t&&o(7,u=t.options)},t.$$.update=()=>{var e;32&t.$$.dirty&&function(t){if(!f)return;if(u.replaceData||!t||!i.data("data")||t.length!==i.data("data").length||t.length&&t[0].id!==i.data("data")[0].id)return i.empty().trigger("change.select2"),i.data("data",t),void i.selectWoo();let e=!1;i.find("option").each(((n,o)=>{if(!t[n])return!1;const i=jQuery(o),s=!0===t[n].selected,r=!0===t[n].disabled;i.prop("selected")!==s&&(i.prop("selected",s),e=!0),i.prop("disabled")!==r&&(i.prop("disabled",r),e=!0)})),e&&(i.trigger("change.select2"),i.selectWoo())}(r),64&t.$$.dirty&&(e=c,f&&(i.data("placeholder",e),i.selectWoo())),128&t.$$.dirty&&function(t){f&&t&&(i.data(t),i.selectWoo())}(u)},[s,l,a,p,i,r,c,u,function(t){lt[t?"unshift":"push"]((()=>{p=t,o(3,p)}))}]}"undefined"!=typeof window&&(window.__svelte||(window.__svelte={v:new Set})).v.add("4");const Dt=class extends qt{constructor(t){super(),Pt(this,t,Bt,Xt,_,{handler:4,name:0,data:5,multiple:1,disabled:2,placeholder:6,options:7})}};function Ht(t,e,n){const o=t.slice();return o[13]=e[n],o[15]=n,o}function Qt(t){let e,n=t[13].image+"";return{c(){e=R("div"),X(e,"class","component-image")},m(t,o){N(t,e,o),e.innerHTML=n},p(t,o){4&o&&n!==(n=t[13].image+"")&&(e.innerHTML=n)},d(t){t&&P(e)}}}function Jt(t){let e,n,o=t[13].sku+"";return{c(){e=R("div"),n=q(o),X(e,"class","component-sku")},m(t,o){N(t,e,o),S(e,n)},p(t,e){4&e&&o!==(o=t[13].sku+"")&&D(n,o)},d(t){t&&P(e)}}}function Ut(t){let e,n,o;return{c(){e=R("div"),n=R("span"),X(n,"class","component-disabled"),X(n,"title",o=t[5].disabled),X(e,"class","component-status")},m(t,o){N(t,e,o),S(e,n)},p:h,d(t){t&&P(e)}}}function Vt(t,e){let n,o,i,s,r,l,a,c,u,d,p,f,h,m,$,g,b,y,w,_,x,k=e[13].title+"",E=e[13].image&&Qt(e),L=e[13].sku&&Jt(e),T=!e[13].enabled&&Ut(e);function z(){return e[9](e[13])}return{key:t,first:null,c(){n=R("div"),E&&E.c(),o=F(),i=R("div"),s=q(k),r=F(),L&&L.c(),l=F(),T&&T.c(),a=F(),c=R("div"),u=R("input"),h=F(),m=R("div"),$=R("button"),b=F(),X(i,"class","component-title"),X(u,"type","number"),X(u,"name",d=e[4].name+"["+e[1]+"]["+e[13].id+"]"),u.value=p=e[0][e[13].id],X(u,"step","any"),X(u,"min","0"),X(u,"placeholder",e[6]),X(u,"title",f=e[5][e[1]].quantityTip),X(c,"class","component-quantity"),X($,"type","button"),X($,"class","remove-component-button"),X($,"title",g=e[5].remove),X(m,"class","component-actions"),X(n,"class","component-item"),Q(n,"disabled",!e[13].enabled),this.first=n},m(t,e){N(t,n,e),E&&E.m(n,null),S(n,o),S(n,i),S(i,s),S(n,r),L&&L.m(n,null),S(n,l),T&&T.m(n,null),S(n,a),S(n,c),S(c,u),S(n,h),S(n,m),S(m,$),S(n,b),w=!0,_||(x=[Y(u,"change",Zt),Y($,"click",z),Y(n,"introend",Kt)],_=!0)},p(t,i){(e=t)[13].image?E?E.p(e,i):(E=Qt(e),E.c(),E.m(n,o)):E&&(E.d(1),E=null),(!w||4&i)&&k!==(k=e[13].title+"")&&D(s,k),e[13].sku?L?L.p(e,i):(L=Jt(e),L.c(),L.m(n,l)):L&&(L.d(1),L=null),e[13].enabled?T&&(T.d(1),T=null):T?T.p(e,i):(T=Ut(e),T.c(),T.m(n,a)),(!w||6&i&&d!==(d=e[4].name+"["+e[1]+"]["+e[13].id+"]"))&&X(u,"name",d),(!w||5&i&&p!==(p=e[0][e[13].id])&&u.value!==p)&&(u.value=p),(!w||2&i&&f!==(f=e[5][e[1]].quantityTip))&&X(u,"title",f),(!w||4&i)&&Q(n,"disabled",!e[13].enabled)},i(t){w||(t&&pt((()=>{w&&(y||(y=zt(n,Yt,{duration:170},!0)),y.run(1))})),w=!0)},o(t){t&&(y||(y=zt(n,Yt,{duration:170},!1)),y.run(0)),w=!1},d(t){t&&P(n),E&&E.d(),L&&L.d(),T&&T.d(),t&&y&&y.end(),_=!1,v(x)}}}function Gt(t){let e,n,o,i,s,r,l,a,c,u,d,p,f,h,m,$=t[5][t[1]].label+"",g=[],b=new Map;a=new Dt({props:{multiple:!0,data:t[3],placeholder:t[5][t[1]].addPlaceholder,options:{width:"auto"}}}),a.$on("change",t[7]);let v=At(t[2]);const y=t=>t[13].id;for(let e=0;e<v.length;e+=1){let n=Ht(t,v,e),o=y(n);b.set(o,g[e]=Vt(o,n))}return{c(){e=R("p"),n=R("label"),o=q($),i=F(),s=R("span"),l=F(),jt(a.$$.fragment),u=F(),d=R("div"),p=R("div"),f=R("div");for(let t=0;t<g.length;t+=1)g[t].c();X(n,"for",""),X(s,"class","woocommerce-help-tip"),X(s,"title",r=t[5][t[1]].fieldTip),X(e,"class",c="form-field mewz_wcas_"+t[1]+"_components_field"),X(f,"class","component-list-inner"),X(p,"class",h="component-list "+t[1]+"-component-list"),X(d,"class","mewz-wcas-components-section"),Q(d,"empty",!t[2].length)},m(t,r){N(t,e,r),S(e,n),S(n,o),S(e,i),S(e,s),S(e,l),Wt(a,e,null),N(t,u,r),N(t,d,r),S(d,p),S(p,f);for(let t=0;t<g.length;t+=1)g[t]&&g[t].m(f,null);m=!0},p(t,[n]){(!m||2&n)&&$!==($=t[5][t[1]].label+"")&&D(o,$),(!m||2&n&&r!==(r=t[5][t[1]].fieldTip))&&X(s,"title",r);const i={};8&n&&(i.data=t[3]),2&n&&(i.placeholder=t[5][t[1]].addPlaceholder),a.$set(i),(!m||2&n&&c!==(c="form-field mewz_wcas_"+t[1]+"_components_field"))&&X(e,"class",c),375&n&&(v=At(t[2]),xt(),g=Ct(g,n,y,1,t,v,b,f,Ot,Vt,null,Ht),kt()),(!m||2&n&&h!==(h="component-list "+t[1]+"-component-list"))&&X(p,"class",h),(!m||4&n)&&Q(d,"empty",!t[2].length)},i(t){if(!m){Et(a.$$.fragment,t);for(let t=0;t<v.length;t+=1)Et(g[t]);m=!0}},o(t){Lt(a.$$.fragment,t);for(let t=0;t<g.length;t+=1)Lt(g[t]);m=!1},d(t){t&&(P(e),P(u),P(d)),Nt(a);for(let t=0;t<g.length;t+=1)g[t].d()}}}function Kt(t){t.target.scrollIntoView({behavior:"smooth",block:"nearest"})}function Zt(t){+t.target.value<=0&&(t.target.value="")}function te(t,e,n){let o,i,{type:s}=e,{components:r}=e;const l=st("data"),{i18n:a}=l,c=ot(),u=1..toLocaleString(l.locale,{minimumFractionDigits:2});function d(t){delete r[t],n(0,r)}return t.$$set=t=>{"type"in t&&n(1,s=t.type),"components"in t&&n(0,r=t.components)},t.$$.update=()=>{1&t.$$.dirty&&n(3,o=function(t){const e=[];for(const n of l.stockList){let o=n.title;n.sku&&(o+=` [${n.sku}]`),n.enabled||(o=`🛇 ${o}`);const i={id:n.id,text:o};n.id in t&&(i.disabled=!0),e.push(i)}return e}(r)),1&t.$$.dirty&&n(2,i=l.stockList.filter((t=>t.id in r)))},[r,s,i,o,l,a,u,function(t){const e=t.detail.handler,o=e.val();var i;o&&o.length&&((i=+o[0])in r||(n(0,r[i]=["",""],r),c("added",{type:s,id:i})),setTimeout((()=>e.focus())))},d,t=>d(t.id)]}const ee=class extends qt{constructor(t){super(),Pt(this,t,te,Gt,w,{type:1,components:0})}};function ne(t){let e;return{c(){e=R("input"),X(e,"type","hidden"),X(e,"name","mewz_wcas_noupdate[components]"),e.value="1"},m(t,n){N(t,e,n)},d(t){t&&P(e)}}}function oe(t){let e,n,o,i,s,r,l,a,c,u=!t[1]&&ne();function d(e){t[3](e)}let p={type:"parent"};function f(e){t[4](e)}void 0!==t[0].parent&&(p.components=t[0].parent),o=new ee({props:p}),lt.push((()=>St(o,"components",d))),o.$on("added",t[2]);let h={type:"child"};return void 0!==t[0].child&&(h.components=t[0].child),l=new ee({props:h}),lt.push((()=>St(l,"components",f))),l.$on("added",t[2]),{c(){u&&u.c(),e=F(),n=R("div"),jt(o.$$.fragment),s=F(),r=R("div"),jt(l.$$.fragment),X(n,"class","options_group"),X(r,"class","options_group")},m(t,i){u&&u.m(t,i),N(t,e,i),N(t,n,i),Wt(o,n,null),N(t,s,i),N(t,r,i),Wt(l,r,null),c=!0},p(t,[n]){t[1]?u&&(u.d(1),u=null):u||(u=ne(),u.c(),u.m(e.parentNode,e));const s={};!i&&1&n&&(i=!0,s.components=t[0].parent,ft((()=>i=!1))),o.$set(s);const r={};!a&&1&n&&(a=!0,r.components=t[0].child,ft((()=>a=!1))),l.$set(r)},i(t){c||(Et(o.$$.fragment,t),Et(l.$$.fragment,t),c=!0)},o(t){Lt(o.$$.fragment,t),Lt(l.$$.fragment,t),c=!1},d(t){t&&(P(e),P(n),P(s),P(r)),u&&u.d(t),Nt(o),Nt(l)}}}function ie(t,e,i){const s=e.data,r=s.components;it("data",s);let l=!1;s.stockItems={};for(const t of s.stockList)s.stockItems[t.id]=t;return nt((()=>{setTimeout((()=>{n("#components_panel .woocommerce-help-tip"),o(document.getElementById("components_panel"),s.name+"[",(t=>i(1,l=t)))}))})),t.$$set=t=>{i(6,e=$($({},e),x(t)))},t.$$.update=()=>{1&t.$$.dirty&&mewzWcas.setTabIndicator("components",Object.values(r.child).length)},e=x(e),[r,l,function(t){const{type:e,id:n}=t.detail;delete r["parent"===e?"child":"parent"][n]},function(e){t.$$.not_equal(r.parent,e)&&(r.parent=e,i(0,r))},function(e){t.$$.not_equal(r.child,e)&&(r.child=e,i(0,r))}]}function se(t,{delay:e=0,duration:n=400,easing:o=Ft,axis:i="y"}={}){const s=getComputedStyle(t),r=+s.opacity,l="y"===i?"height":"width",a=parseFloat(s[l]),c="y"===i?["top","bottom"]:["left","right"],u=c.map((t=>`${t[0].toUpperCase()}${t.slice(1)}`)),d=parseFloat(s[`padding${u[0]}`]),p=parseFloat(s[`padding${u[1]}`]),f=parseFloat(s[`margin${u[0]}`]),h=parseFloat(s[`margin${u[1]}`]),m=parseFloat(s[`border${u[0]}Width`]),$=parseFloat(s[`border${u[1]}Width`]);return{delay:e,duration:n,easing:o,css:t=>`overflow: hidden;opacity: ${Math.min(20*t,1)*r};${l}: ${t*a}px;padding-${c[0]}: ${t*d}px;padding-${c[1]}: ${t*p}px;margin-${c[0]}: ${t*f}px;margin-${c[1]}: ${t*h}px;border-${c[0]}-width: ${t*m}px;border-${c[1]}-width: ${t*$}px;`}}function re(t,e){e=Object.assign({open:!0,duration:.2,easing:"ease"},e);const n=()=>{};let o=n,i=n;const s=t.addEventListener("transitionend",(()=>{o(),o=n,i=n}));async function r(){return new Promise(requestAnimationFrame)}function l(){return`height ${e.duration}s ${e.easing}`}return t.style.transition=l(),t.style.height=e.open?"auto":"0px",e.open?t.style.overflow="visible":t.style.overflow="hidden",{update:function(n){(e=Object.assign(e,n)).open?async function(){t.style.height=t.scrollHeight+"px";try{await async function(){return new Promise(((t,e)=>{o=t,i=e}))}(),t.style.height="auto",t.style.overflow="visible"}catch(t){}}():async function(){"auto"===t.style.height?(t.style.transition="none",await r(),t.style.height=t.scrollHeight+"px",t.style.transition=l(),await r(),t.style.overflow="hidden",t.style.height="0px"):(i(),t.style.overflow="hidden",t.style.height="0px")}()},destroy:function(){t.removeEventListener("transitionend",s)}}}function le(t,{dragStart:e,dragMove:n,dragEnd:o,exclude:i,enabled:s=!0}){function r(t){if(!s||i&&t.target.closest(i))return;const r=ae(t);r&&(t.preventDefault(),function(t,e,{dragStart:n,dragMove:o,dragEnd:i}){let s,r=t,l=e.clientX,a=e.clientY,c=l+window.scrollX,u=a+window.scrollY,d=0,p=0;function f(t){const e=ae(t);e&&(r=t,l=e.clientX,a=e.clientY,d=l+window.scrollX-c,p=a+window.scrollY-u,o&&o({event:t,pointer:e,x:l,y:top,startX:c,startY:u,moveX:d,moveY:p}))}function h(t){const e=ae(t,s);e&&(r=t,"mouseup"===t.type?(window.removeEventListener("mousemove",f),window.removeEventListener("mouseup",h)):(window.removeEventListener("touchmove",f),window.removeEventListener("touchend",h)),window.removeEventListener("scroll",m),i&&i({event:t,pointer:e,x:l,y:top,startX:c,startY:u,moveX:d,moveY:p}))}function m(){d=l+window.scrollX-c,p=a+window.scrollY-u,o({event:r,pointer:e,x:l,y:top,startX:c,startY:u,moveX:d,moveY:p})}"mousedown"===t.type?(window.addEventListener("mousemove",f),window.addEventListener("mouseup",h)):(s=e.identifier,window.addEventListener("touchmove",f),window.addEventListener("touchend",h)),window.addEventListener("scroll",m),n&&n({event:t,pointer:e,x:l,y:top,startX:c,startY:u})}(t,r,{dragStart:e,dragMove:n,dragEnd:o}))}return t.addEventListener("mousedown",r),t.addEventListener("touchstart",r,{passive:!1}),{update(t){i=t.exclude,s=t.enabled},destroy(){t.removeEventListener("mousedown",r),t.removeEventListener("touchstart",r)}}}function ae(t,e){return t instanceof MouseEvent?0===t.button?t:null:void 0===e?1===t.touches.length?t.touches[0]:null:function(t,e){for(const n of t)if(n.identifier===e)return n;return null}(t.changedTouches,e)}function ce(t,e,n){const o=t.slice();o[43]=e[n],o[45]=e,o[46]=n;const i=`${o[8].name}[${o[3]}][attributes][${o[43][0]}]`;return o[44]=i,o}function ue(t,e,n){const o=t.slice();return o[47]=e[n],o[49]=n,o}function de(t){let e,n,o,i,s=t[9].ruleTitle.replace("%s",t[3]+1)+"";return{c(){e=R("span"),n=q(s),o=F(),i=R("span"),i.textContent="—",X(e,"class","toolbar-label toolbar-label-title"),X(i,"class","sep")},m(t,s){N(t,e,s),S(e,n),N(t,o,s),N(t,i,s)},p(t,e){8&e[0]&&s!==(s=t[9].ruleTitle.replace("%s",t[3]+1)+"")&&D(n,s)},d(t){t&&(P(e),P(o),P(i))}}}function pe(t){let e,n,o=t[47].name+"";return{c(){e=R("span"),n=q(o),X(e,"class","name")},m(t,o){N(t,e,o),S(e,n)},p(t,e){3&e[0]&&o!==(o=t[47].name+"")&&D(n,o)},d(t){t&&P(e)}}}function fe(t,e){let n,o,i,s,r,l,a,c,u=(e[47].value||"")+"",d=e[47].name&&pe(e);return{key:t,first:null,c(){n=R("span"),d&&d.c(),o=F(),i=R("span"),s=q(u),r=F(),X(i,"class","value"),X(n,"class",l="toolbar-label toolbar-label-"+e[47].type+(e[47].class?" "+e[47].class:"")),X(n,"title",a=e[47].title),X(n,"rel",c=e[47].title?"tiptip":null),this.first=n},m(t,e){N(t,n,e),d&&d.m(n,null),S(n,o),S(n,i),S(i,s),S(n,r)},p(t,i){(e=t)[47].name?d?d.p(e,i):(d=pe(e),d.c(),d.m(n,o)):d&&(d.d(1),d=null),3&i[0]&&u!==(u=(e[47].value||"")+"")&&D(s,u),3&i[0]&&l!==(l="toolbar-label toolbar-label-"+e[47].type+(e[47].class?" "+e[47].class:""))&&X(n,"class",l),3&i[0]&&a!==(a=e[47].title)&&X(n,"title",a),3&i[0]&&c!==(c=e[47].title?"tiptip":null)&&X(n,"rel",c)},d(t){t&&P(n),d&&d.d()}}}function he(t,e){let n,o,i,s,r,l,a,c,u,d,p,f,h,m,$,g,b,v,y,w;function _(){return e[28](e[46])}return s=new Dt({props:{data:e[12](e[43][0]),placeholder:{id:"",text:e[9].attributePlaceholder},options:{init:!0,fixPosition:!0}}}),s.$on("change",(function(...t){return e[26](e[43],e[45],e[46],...t)})),d=new Dt({props:{name:e[44]+"[]",multiple:!0,data:e[13](e[43]),placeholder:e[43][0]?e[9].anyOption.replace("%s",e[8].attributes[e[43][0]].label):e[9].termPlaceholder,disabled:!e[43][0],options:{init:!0,width:"auto",fixPosition:!0}}}),d.$on("change",(function(...t){return e[27](e[43],e[45],e[46],...t)})),{key:t,first:null,c(){n=R("div"),o=R("div"),i=R("div"),jt(s.$$.fragment),r=F(),l=R("div"),a=R("input"),u=F(),jt(d.$$.fragment),p=F(),f=R("div"),h=R("button"),g=F(),X(i,"class","select-attribute"),X(a,"type","hidden"),X(a,"name",c=e[44]),a.value="",X(l,"class","select-terms"),X(h,"type","button"),X(h,"class","icon-button row-remove-button"),X(h,"title",m=e[9].removeAttribute),h.disabled=$=1===e[0].length&&!e[43].attribute,X(f,"class","attribute-row-actions"),X(o,"class","attribute-row-inner"),X(n,"class","attribute-row"),this.first=n},m(t,e){N(t,n,e),S(n,o),S(o,i),Wt(s,i,null),S(o,r),S(o,l),S(l,a),S(l,u),Wt(d,l,null),S(o,p),S(o,f),S(f,h),S(n,g),v=!0,y||(w=Y(h,"click",_),y=!0)},p(t,n){e=t;const o={};1&n[0]&&(o.data=e[12](e[43][0])),s.$set(o),(!v||9&n[0]&&c!==(c=e[44]))&&X(a,"name",c);const i={};9&n[0]&&(i.name=e[44]+"[]"),1&n[0]&&(i.data=e[13](e[43])),1&n[0]&&(i.placeholder=e[43][0]?e[9].anyOption.replace("%s",e[8].attributes[e[43][0]].label):e[9].termPlaceholder),1&n[0]&&(i.disabled=!e[43][0]),d.$set(i),(!v||1&n[0]&&$!==($=1===e[0].length&&!e[43].attribute))&&(h.disabled=$)},i(t){v||(Et(s.$$.fragment,t),Et(d.$$.fragment,t),t&&pt((()=>{v&&(b||(b=zt(n,Yt,{duration:130},!0)),b.run(1))})),v=!0)},o(t){Lt(s.$$.fragment,t),Lt(d.$$.fragment,t),t&&(b||(b=zt(n,Yt,{duration:130},!1)),b.run(0)),v=!1},d(t){t&&P(n),Nt(s),Nt(d),t&&b&&b.end(),y=!1,w()}}}function me(t){let e,n,o,i,s,r;return{c(){e=R("div"),n=R("button"),n.textContent="Add attribute",X(n,"type","button"),X(n,"class","row-add-button"),X(e,"class","attribute-list-actions")},m(o,l){N(o,e,l),S(e,n),i=!0,s||(r=Y(n,"click",t[29]),s=!0)},p:h,i(t){i||(t&&pt((()=>{i&&(o||(o=zt(e,se,{duration:100},!0)),o.run(1))})),i=!0)},o(t){t&&(o||(o=zt(e,se,{duration:100},!1)),o.run(0)),i=!1},d(t){t&&P(e),t&&o&&o.end(),s=!1,r()}}}function $e(t){let e,n,o,i,s,r,l,a,c,u,d,p,f,$,g,b,w,_,x,E,T,z,A,O,C,I,j,W,D,J,U,V,G,tt,et,nt,ot,it,st,rt,lt,at,ct,ut=[],dt=new Map,ft=[],ht=new Map,mt=t[9].multiplierLabel+"",$t=t[5]>1&&de(t),gt=At(t[14](t[0],t[1]));const bt=t=>t[49]+t[47].type;for(let e=0;e<gt.length;e+=1){let n=ue(t,gt,e),o=bt(n);dt.set(o,ut[e]=fe(o,n))}let wt=At(t[0]);const zt=t=>t[43];for(let e=0;e<wt.length;e+=1){let n=ce(t,wt,e),o=zt(n);ht.set(o,ft[e]=he(o,n))}let It=t[0].length<t[10]&&me(t);return{c(){e=R("div"),n=R("div"),o=R("div"),$t&&$t.c(),i=F();for(let t=0;t<ut.length;t+=1)ut[t].c();s=F(),r=R("span"),l=R("span"),a=F(),c=R("button"),p=F(),f=R("button"),g=F(),b=R("button"),_=F(),x=R("div"),E=R("div"),T=R("div"),z=R("div");for(let t=0;t<ft.length;t+=1)ft[t].c();A=F(),It&&It.c(),O=F(),C=R("div"),I=R("div"),j=R("label"),W=q(mt),D=F(),J=R("span"),V=F(),G=R("input"),X(o,"class","toolbar-labels"),X(l,"class","toolbar-action icon-button expand-button"),X(c,"type","button"),X(c,"class","toolbar-action icon-button drag-button"),X(c,"title",u=t[9].dragTip),X(f,"type","button"),X(f,"class","toolbar-action icon-button duplicate-button"),X(f,"title",$=t[9].duplicateRule),X(b,"type","button"),X(b,"class","toolbar-action icon-button remove-button"),X(b,"title",w=t[9].removeRule),X(r,"class","match-rule-toolbar-actions"),X(n,"class","match-rule-toolbar"),X(z,"class","attribute-rows"),X(T,"class","attribute-list"),X(J,"class","woocommerce-help-tip"),X(J,"title",U=t[9].multiplierTip),X(G,"type","number"),X(G,"name",tt=t[17](t[3],"multiplier")),X(G,"step","any"),X(G,"min","-1"),X(G,"placeholder",et=t[22](t[0])),X(G,"lang",nt=t[8].locale),X(I,"class","option option-multiplier"),X(C,"class","match-rule-options"),X(E,"class","match-rule-body-inner"),X(x,"class","match-rule-body"),X(e,"class","mewz-wcas-match-rule"),X(e,"style",it=ge(t[7])),Q(e,"zero-multiplier",null!=t[1]&&""!==t[1]&&0==+t[1]),Q(e,"stop-rule",+t[1]<0),Q(e,"open",t[2]),Q(e,"dragging",t[7]),Q(e,"released",t[7]&&t[7].released)},m(u,h){N(u,e,h),S(e,n),S(n,o),$t&&$t.m(o,null),S(o,i);for(let t=0;t<ut.length;t+=1)ut[t]&&ut[t].m(o,null);S(n,s),S(n,r),S(r,l),S(r,a),S(r,c),S(r,p),S(r,f),S(r,g),S(r,b),S(e,_),S(e,x),S(x,E),S(E,T),S(T,z);for(let t=0;t<ft.length;t+=1)ft[t]&&ft[t].m(z,null);S(T,A),It&&It.m(T,null),S(E,O),S(E,C),S(C,I),S(I,j),S(j,W),S(j,D),S(j,J),S(I,V),S(I,G),H(G,t[1]),t[31](e),lt=!0,at||(ct=[k(d=le.call(null,c,{dragStart:t[19],dragMove:t[20],dragEnd:t[21],enabled:t[4]})),Y(f,"click",t[24]),Y(b,"click",t[25]),Y(n,"click",t[18]),Y(G,"input",t[30]),k(ot=re.call(null,x,{open:t[2],duration:.17}))],at=!0)},p(t,n){t[5]>1?$t?$t.p(t,n):($t=de(t),$t.c(),$t.m(o,i)):$t&&($t.d(1),$t=null),16387&n[0]&&(gt=At(t[14](t[0],t[1])),ut=Ct(ut,n,bt,1,t,gt,dt,o,Mt,fe,null,ue)),d&&y(d.update)&&16&n[0]&&d.update.call(null,{dragStart:t[19],dragMove:t[20],dragEnd:t[21],enabled:t[4]}),78601&n[0]&&(wt=At(t[0]),xt(),ft=Ct(ft,n,zt,1,t,wt,ht,z,Ot,he,null,ce),kt()),t[0].length<t[10]?It?(It.p(t,n),1&n[0]&&Et(It,1)):(It=me(t),It.c(),Et(It,1),It.m(T,null)):It&&(xt(),Lt(It,1,1,(()=>{It=null})),kt()),(!lt||8&n[0]&&tt!==(tt=t[17](t[3],"multiplier")))&&X(G,"name",tt),(!lt||1&n[0]&&et!==(et=t[22](t[0])))&&X(G,"placeholder",et),2&n[0]&&B(G.value)!==t[1]&&H(G,t[1]),ot&&y(ot.update)&&4&n[0]&&ot.update.call(null,{open:t[2],duration:.17}),(!lt||128&n[0]&&it!==(it=ge(t[7])))&&X(e,"style",it),(!lt||2&n[0])&&Q(e,"zero-multiplier",null!=t[1]&&""!==t[1]&&0==+t[1]),(!lt||2&n[0])&&Q(e,"stop-rule",+t[1]<0),(!lt||4&n[0])&&Q(e,"open",t[2]),(!lt||128&n[0])&&Q(e,"dragging",t[7]),(!lt||128&n[0])&&Q(e,"released",t[7]&&t[7].released)},i(t){if(!lt){for(let t=0;t<wt.length;t+=1)Et(ft[t]);Et(It),t&&pt((()=>{lt&&(rt&&rt.end(1),st=function(t,e,n){const o={direction:"in"};let i,s,r=e(t,{duration:170},o),l=!1,a=0;function c(){i&&Z(t,i)}function u(){const{delay:e=0,duration:n=300,easing:o=m,tick:u=h,css:d}=r||Tt;d&&(i=K(t,0,1,n,e,o,d,a++)),u(0,1);const p=L()+e,f=p+n;s&&s.abort(),l=!0,pt((()=>yt(t,!0,"start"))),s=M((e=>{if(l){if(e>=f)return u(1,0),yt(t,!0,"end"),c(),l=!1;if(e>=p){const t=o((e-p)/n);u(t,1-t)}}return l}))}let d=!1;return{start(){d||(d=!0,Z(t),y(r)?(r=r(o),vt().then(u)):u())},invalidate(){d=!1},end(){l&&(c(),l=!1)}}}(e,Yt),st.start())})),lt=!0}},o(t){for(let t=0;t<ft.length;t+=1)Lt(ft[t]);Lt(It),st&&st.invalidate(),t&&(rt=function(t,e,n){const o={direction:"out"};let i,s=e(t,{duration:170},o),r=!0;const l=_t;let a;function c(){const{delay:e=0,duration:n=300,easing:o=m,tick:c=h,css:u}=s||Tt;u&&(i=K(t,1,0,n,e,o,u));const d=L()+e,p=d+n;pt((()=>yt(t,!1,"start"))),"inert"in t&&(a=t.inert,t.inert=!0),M((e=>{if(r){if(e>=p)return c(0,1),yt(t,!1,"end"),--l.r||v(l.c),!1;if(e>=d){const t=o((e-d)/n);c(1-t,t)}}return r}))}return l.r+=1,y(s)?vt().then((()=>{s=s(o),c()})):c(),{end(e){e&&"inert"in t&&(t.inert=a),e&&s.tick&&s.tick(1,0),r&&(i&&Z(t,i),r=!1)}}}(e,Yt)),lt=!1},d(n){n&&P(e),$t&&$t.d();for(let t=0;t<ut.length;t+=1)ut[t].d();for(let t=0;t<ft.length;t+=1)ft[t].d();It&&It.d(),t[31](null),n&&rt&&rt.end(),at=!1,v(ct)}}}function ge(t){if(t)return`transform: translateY(${t.offset}px);`}function be(t,e,o){let i,{index:s}=e,{attributes:r}=e,{multiplier:l=""}=e,{mounted:a=!1}=e,{open:c=!0}=e,{draggable:u=!0}=e,{ruleCount:d=1}=e;const p=st("data"),f=p.i18n,h=Object.keys(p.attributes).length,m=ot(),$=k(1,!0);let g,b=!1;function v(){const t=[0,[]];r?(r.push(t),o(0,r)):o(0,r=[t]),a&&setTimeout((()=>{const t=g.querySelector(".attribute-row:last-child .select-attribute select");t&&jQuery(t).focus()}),150)}function y(t){r.splice(t,1),r.length?o(0,r):v()}function w(t){if(!t||t.target===g){b.released&&g.removeEventListener("transitionend",w);for(const t of b.list)t.el.style.transform="";m("dragging",[s,!1]),b.targetIndex!==s&&m("action",["shift",s,b.targetIndex]),o(7,b=!1)}}function _(){const t=g.parentNode.querySelectorAll(".mewz-wcas-match-rule"),e=[];let n=0;for(const o of t){const t=o.offsetHeight;e.push({el:o,height:t,mid:n+Math.round(t/2),offset:0}),n+=t}return e}function x(t){const e={};for(const n of t)e[n[0]]=n[1];for(const[t]of p.attributeOptions){const n=e[t];if(!n)continue;const o=p.attributes[t];if(1===n.length){for(const t of o.terms)if(t[0]===n[0]&&null!=t[2])return+t[2]}else{let t=[1/0,0],e=!1;for(const i of o.terms){if(n.length&&!n.includes(i[0]))continue;if(null==i[2]){e=!0;continue}const o=+i[2];o<t[0]&&(t[0]=o),o>t[1]&&(t[1]=o)}if(t[0]!==1/0)return e&&t[0]>1&&(t[0]=1),t[0]===t[1]?t[0]:t}}return null}function k(t,e){const n=e&&t<10?{minimumFractionDigits:2}:{maximumSignificantDigits:20,maximumFractionDigits:20};return t.toLocaleString(p.locale,n)}return nt((()=>{n(".mewz-wcas-match-rule .woocommerce-help-tip")})),t.$$set=t=>{"index"in t&&o(3,s=t.index),"attributes"in t&&o(0,r=t.attributes),"multiplier"in t&&o(1,l=t.multiplier),"mounted"in t&&o(23,a=t.mounted),"open"in t&&o(2,c=t.open),"draggable"in t&&o(4,u=t.draggable),"ruleCount"in t&&o(5,d=t.ruleCount)},t.$$.update=()=>{1&t.$$.dirty[0]&&(r.length||v()),1&t.$$.dirty[0]&&(i=function(t){const e={};for(const n of t)n[0]&&(e[n[0]]=!0);return e}(r))},[r,l,c,s,u,d,g,b,p,f,h,m,function(t){const e=[{id:"",text:""}];for(const[n,o]of p.attributeOptions){const s={id:n,text:o};n===t?s.selected=!0:i[n]&&(s.disabled=!0),e.push(s)}return e},function(t){if(!t[0])return[];const e=p.attributes[t[0]].terms,n=[],o={};for(const e of t[1])o[e]=!0;for(const[t,i]of e){const e={id:t,text:i};o[t]&&(e.selected=!0),n.push(e)}return n},function(t,e){const o=[];for(const[e,n]of t){if(!e||!n)continue;const t=[];if(n.length)for(const o of p.attributes[e].terms)if(n.includes(o[0])&&(t.push(o[1]),t.length===n.length))break;o.push({type:"attribute",name:p.attributes[e].label,value:t.length?t.join(", "):f.any})}if(o.length||o.push({type:"attribute",value:"..."}),null!=e&&""!==e&&1!=+e)+e<0?(o.push({type:"stop",title:f.stopRuleTip}),setTimeout((()=>n('.mewz-wcas-match-rule [rel="tiptip"]')))):o.push({type:"multiplier",value:`×${k(+e)}`});else if(1!=+e){const e=x(t);if(null!=e){let t;t=Array.isArray(e)?`×${k(e[0])}–${k(e[1])}`:`×${k(e)}`,o.push({type:"multiplier",class:"inherited",title:f.multiplierInherited,value:t})}}return o},v,y,function(t,e){return`${p.name}[${t}][${e}]`},function(t){b||t&&t.target.closest("button")||o(2,c=!c)},function(t){b||(o(7,b={height:g.offsetHeight,start:g.offsetTop,offset:0,end:g.parentNode.offsetHeight,list:_(),targetIndex:s,animatedIndex:s,released:!1}),m("dragging",[s,{released:!1}]))},function(t){b&&!b.released&&(o(7,b.offset=Math.max(-b.start,t.moveY),b),o(7,b.offset=Math.min(b.offset,b.end-b.start-b.height),b),o(7,b.targetIndex=function(){let t=s;const e=b.start+b.offset;for(let n=0;n<b.list.length;n++){const o=b.list[n].mid;if(n<s){if(e<o)return n}else n>s&&e+b.height>o&&(t=n)}return t}(),b),function(){if(b.targetIndex===b.animatedIndex)return;const t=b.targetIndex;for(let e=0;e<b.list.length;e++){const n=b.list[e];let o=0;t<s?e>=t&&e<s&&(o=b.height):t>s&&e<=t&&e>s&&(o=-b.height),n.offset!==o&&(n.el.style.transform=`translateY(${o}px)`,n.offset=o,null==n.animating&&n.el.addEventListener("transitionend",(()=>{n.animating=!1})),n.animating=!0)}o(7,b.animatedIndex=t,b)}())},function(){if(!b||b.released)return;const t=function(){const t=b.targetIndex;let e=0;if(t<s)for(let n=t;n<s;n++)e-=b.list[n].height;else if(t>s)for(let n=t;n>s;n--)e+=b.list[n].height;return e}();b.offset===t?b.targetIndex===s?(m("dragging",[s,!1]),o(7,b=!1)):b.list.some((t=>!0===t.animating))?(setTimeout(w,200),m("dragging",[s,{released:!0}])):w():(g.addEventListener("transitionend",w),o(7,b.offset=t,b),o(7,b.released=!0,b),m("dragging",[s,{released:!0}]))},function(t){const e=x(t);return null==e?$:Array.isArray(e)?k(e[0])+" – "+k(e[1]):k(e,!0)},a,()=>m("action",["duplicate",s]),()=>m("action",["remove",s]),(t,e,n,i)=>o(0,e[n][0]=+i.detail.handler.val(),r),(t,e,n,i)=>o(0,e[n][1]=i.detail.handler.val().map(Number),r),t=>y(t),()=>v(),function(){l=B(this.value),o(1,l)},function(t){lt[t?"unshift":"push"]((()=>{g=t,o(6,g)}))}]}const ve=class extends qt{constructor(t){super(),Pt(this,t,be,$e,w,{index:3,attributes:0,multiplier:1,mounted:23,open:2,draggable:4,ruleCount:5},null,[-1,-1])}};function ye(t,e,n){const o=t.slice();return o[26]=e[n],o[27]=e,o[28]=n,o}function we(t){let e,n,o,i;return{c(){e=R("button"),X(e,"type","button"),X(e,"class","button restore-button"),X(e,"title",n=t[1].i18n.restoreRule)},m(n,s){N(n,e,s),o||(i=Y(e,"click",t[11]),o=!0)},p(t,o){2&o&&n!==(n=t[1].i18n.restoreRule)&&X(e,"title",n)},d(t){t&&P(e),o=!1,i()}}}function _e(t,e){let n,o,i,s,r,l,a;function c(t){e[14](t)}function u(t){e[15](t,e[26])}function d(t){e[16](t,e[26])}function p(t){e[17](t,e[26])}let f={index:e[28],draggable:!e[6],ruleCount:e[0].length};return void 0!==e[5]&&(f.mounted=e[5]),void 0!==e[26].attributes&&(f.attributes=e[26].attributes),void 0!==e[26].multiplier&&(f.multiplier=e[26].multiplier),void 0!==e[26].open&&(f.open=e[26].open),o=new ve({props:f}),lt.push((()=>St(o,"mounted",c))),lt.push((()=>St(o,"attributes",u))),lt.push((()=>St(o,"multiplier",d))),lt.push((()=>St(o,"open",p))),o.$on("action",e[10]),o.$on("dragging",e[9]),{key:t,first:null,c(){n=q(""),jt(o.$$.fragment),this.first=n},m(t,e){N(t,n,e),Wt(o,t,e),a=!0},p(t,n){e=t;const a={};1&n&&(a.index=e[28]),64&n&&(a.draggable=!e[6]),1&n&&(a.ruleCount=e[0].length),!i&&32&n&&(i=!0,a.mounted=e[5],ft((()=>i=!1))),!s&&1&n&&(s=!0,a.attributes=e[26].attributes,ft((()=>s=!1))),!r&&1&n&&(r=!0,a.multiplier=e[26].multiplier,ft((()=>r=!1))),!l&&1&n&&(l=!0,a.open=e[26].open,ft((()=>l=!1))),o.$set(a)},i(t){a||(Et(o.$$.fragment,t),a=!0)},o(t){Lt(o.$$.fragment,t),a=!1},d(t){t&&P(n),Nt(o,t)}}}function xe(t){let e;return{c(){e=R("input"),X(e,"type","hidden"),X(e,"name","mewz_wcas_noupdate[rules]"),e.value="1"},m(t,n){N(t,e,n)},d(t){t&&P(e)}}}function ke(t){let e,n,o,i,s,r,l,a,c,u,d,p,f,h,m,$,g,b,y,w,_=t[1].i18n.newRule+"",x=(Ee(t[0])?t[1].i18n.closeAll:t[1].i18n.expandAll)+"",k=[],E=new Map,L=t[4].length&&we(t),T=At(t[0]);const z=t=>t[26];for(let e=0;e<T.length;e+=1){let n=ye(t,T,e),o=z(n);E.set(o,k[e]=_e(o,n))}let A=!t[7]&&xe();return{c(){e=R("div"),n=R("div"),o=R("div"),i=R("button"),s=q(_),r=F(),l=R("span"),c=F(),u=R("div"),L&&L.c(),d=F(),p=R("button"),f=q(x),m=F(),$=R("div");for(let t=0;t<k.length;t+=1)k[t].c();g=F(),A&&A.c(),X(i,"type","button"),X(i,"class","button add-button"),X(l,"class","woocommerce-help-tip"),X(l,"title",a=t[1].i18n.newRuleTip),X(o,"class","toolbar-left"),X(p,"type","button"),X(p,"class",h="button toggle-button "+(Ee(t[0])?"collapse":"expand")),X(u,"class","toolbar-right"),X(n,"class","main-toolbar"),X($,"class","match-rules-list"),X(e,"class","mewz-wcas-attribute-rules"),Q(e,"dragging",t[6]),Q(e,"released",t[6]&&t[6].released)},m(a,h){N(a,e,h),S(e,n),S(n,o),S(o,i),S(i,s),S(o,r),S(o,l),S(n,c),S(n,u),L&&L.m(u,null),S(u,d),S(u,p),S(p,f),S(e,m),S(e,$);for(let t=0;t<k.length;t+=1)k[t]&&k[t].m($,null);t[18]($),S(e,g),A&&A.m(e,null),t[19](e),b=!0,y||(w=[Y(i,"click",t[13]),Y(p,"click",t[12])],y=!0)},p(t,[n]){(!b||2&n)&&_!==(_=t[1].i18n.newRule+"")&&D(s,_),(!b||2&n&&a!==(a=t[1].i18n.newRuleTip))&&X(l,"title",a),t[4].length?L?L.p(t,n):(L=we(t),L.c(),L.m(u,d)):L&&(L.d(1),L=null),(!b||3&n)&&x!==(x=(Ee(t[0])?t[1].i18n.closeAll:t[1].i18n.expandAll)+"")&&D(f,x),(!b||1&n&&h!==(h="button toggle-button "+(Ee(t[0])?"collapse":"expand")))&&X(p,"class",h),1633&n&&(T=At(t[0]),xt(),k=Ct(k,n,z,1,t,T,E,$,Ot,_e,null,ye),kt()),t[7]?A&&(A.d(1),A=null):A||(A=xe(),A.c(),A.m(e,null)),(!b||64&n)&&Q(e,"dragging",t[6]),(!b||64&n)&&Q(e,"released",t[6]&&t[6].released)},i(t){if(!b){for(let t=0;t<T.length;t+=1)Et(k[t]);b=!0}},o(t){for(let t=0;t<k.length;t+=1)Lt(k[t]);b=!1},d(n){n&&P(e),L&&L.d();for(let t=0;t<k.length;t+=1)k[t].d();t[18](null),A&&A.d(),t[19](null),y=!1,v(w)}}}function Ee(t){return t.every((t=>t.open))}function Le(t){for(const e of t.attributes)if(e[0])return!0;return!1}function Te(t,e,i){const s=e.data;let r,l;it("data",s);let a=[],c=[],u=!1,d=!1,p=!1;const f=s.rules;if(f.length){if(1===f.length)f[0].open=!0;else for(let t of f)t.open=!1;a=f}else m();const h=[];for(let t in s.attributes){const e=s.attributes[t];h.push([+t,e.label])}function m(){const t={attributes:[],multiplier:"",open:!0};return a.push(t),i(0,a),t}return s.attributeOptions=h.sort(((t,e)=>t[1].localeCompare(e[1]))),nt((()=>{n(".mewz-wcas-attribute-rules .main-toolbar .woocommerce-help-tip"),o(r,s.name+"[",(t=>i(7,p=t))),i(5,u=!0)})),t.$$set=t=>{i(25,e=$($({},e),x(t)))},t.$$.update=()=>{1&t.$$.dirty&&mewzWcas.setTabIndicator("attributes",a.filter(Le).length)},e=x(e),[a,s,r,l,c,u,d,p,m,function(t){const[e,n]=t.detail;i(6,d=n)},function(t){const[e,n,o]=t.detail;"duplicate"===e?function(t){const e=JSON.parse(JSON.stringify(a[t]));e.open=!0,a.splice(t+1,0,e),i(0,a)}(n):"remove"===e?function(t){const e=a.splice(t,1)[0];e&&(Le(e)&&(e.lastIndex=t,c.push(e),i(4,c)),a.length?i(0,a):m())}(n):"shift"===e&&function(t,e){const n=a.splice(t,1)[0];a.splice(e,0,n),i(0,a)}(n,o)},function(){const t=c.pop();t&&(1!==a.length||Le(a[0])?a.splice(t.lastIndex,0,t):i(0,a[0]=t,a),delete t.lastIndex,i(4,c),i(0,a))},function(){const t=Ee(a);a.forEach((e=>e.open=!t)),i(0,a)},()=>m(),function(t){u=t,i(5,u)},function(e,n){t.$$.not_equal(n.attributes,e)&&(n.attributes=e,i(0,a))},function(e,n){t.$$.not_equal(n.multiplier,e)&&(n.multiplier=e,i(0,a))},function(e,n){t.$$.not_equal(n.open,e)&&(n.open=e,i(0,a))},function(t){lt[t?"unshift":"push"]((()=>{l=t,i(3,l)}))},function(t){lt[t?"unshift":"push"]((()=>{r=t,i(2,r)}))}]}s("#post").on("submit",(function(){const t=s("#mewz-wcas-stock-status");t.find(".spinner").addClass("is-active"),t.find("#submit").prop("disabled",!0)})),s("#mewz_wcas_internal").on("change",r),r(),setTimeout(e),a.html&&l(a.html).insertAfter(".wrap > .page-title-action"),u=document.getElementById("post"),mewzWcas.setTabIndicator=d,p("settings"),p("filters"),new class extends qt{constructor(t){super(),Pt(this,t,ie,oe,w,{})}}({target:document.getElementById("components_panel"),props:{data:mewzWcas.components}}),new class extends qt{constructor(t){super(),Pt(this,t,Te,ke,w,{})}}({target:document.getElementById("attributes_panel"),props:{data:mewzWcas.matchRules}})})()})();
     1(()=>{"use strict";(()=>{let t=!1;function e(e){e&&!t||jQuery(document.body).trigger("wc-enhanced-select-init")}function n(t){jQuery(t).tipTip({fadeIn:50,fadeOut:50,delay:200})}function o(t,e,n){const o=t.closest("form");o?setTimeout((()=>{const t=i(o,e);o.addEventListener("submit",(()=>{const s=i(o,e)!==t;n(s)}))}),300):n(!0)}function i(t,e){const n=new FormData(t),o=[];for(const t of n.entries())t[0].startsWith(e)&&o.push(t[0],t[1]);return JSON.stringify(o)}jQuery(document.body).one("wc-enhanced-select-init",(()=>{t=!0}));const s=jQuery;function r(){const t=s("#mewz_wcas_internal"),e=t.prop("checked")||t.prop("disabled");s("#mewz_wcas_product_sku").prop("disabled",e),s("#mewz_wcas_product_image").prop("disabled",e)}const l=jQuery,a=window.mewzWcas&&mewzWcas.headerActions||{},c=jQuery;let u;function d(t,e){const n=u.querySelector(`.wc-tabs > .${t}_tab a`);n&&(e?n.dataset.indicator=e:delete n.dataset.indicator)}function p(t){const e=c(`#${t}_panel`);e.on("change input",(()=>{f(t,e)})),f(t,e)}function f(t,e){const n=e.find(":input:not(:disabled, .select2-search__field)");let o=0;n.each((function(){const t=c(this),e="checkbox"===t.attr("type")?t.prop("checked"):t.val();Array.isArray(e)?o+=e.length:e&&o++})),d(t,o)}function h(){}const m=t=>t;function $(t,e){for(const n in e)t[n]=e[n];return t}function g(t){return t()}function b(){return Object.create(null)}function v(t){t.forEach(g)}function y(t){return"function"==typeof t}function w(t,e){return t!=t?e==e:t!==e||t&&"object"==typeof t||"function"==typeof t}function _(t,e){return t!=t?e==e:t!==e}function x(t){const e={};for(const n in t)"$"!==n[0]&&(e[n]=t[n]);return e}function k(t){return t&&y(t.destroy)?t.destroy:h}const E="undefined"!=typeof window;let L=E?()=>window.performance.now():()=>Date.now(),T=E?t=>requestAnimationFrame(t):h;const z=new Set;function A(t){z.forEach((e=>{e.c(t)||(z.delete(e),e.f())})),0!==z.size&&T(A)}function M(t){let e;return 0===z.size&&T(A),{promise:new Promise((n=>{z.add(e={c:t,f:n})})),abort(){z.delete(e)}}}const O="undefined"!=typeof window?window:"undefined"!=typeof globalThis?globalThis:global;class C{_listeners="WeakMap"in O?new WeakMap:void 0;_observer=void 0;options;constructor(t){this.options=t}observe(t,e){return this._listeners.set(t,e),this._getObserver().observe(t,this.options),()=>{this._listeners.delete(t),this._observer.unobserve(t)}}_getObserver(){return this._observer??(this._observer=new ResizeObserver((t=>{for(const e of t)C.entries.set(e.target,e),this._listeners.get(e.target)?.(e)})))}}C.entries="WeakMap"in O?new WeakMap:void 0;let I=!1;function S(t,e){t.appendChild(e)}function j(t){if(!t)return document;const e=t.getRootNode?t.getRootNode():t.ownerDocument;return e&&e.host?e:t.ownerDocument}function W(t){const e=R("style");return e.textContent="/* empty */",function(t,e){S(t.head||t,e),e.sheet}(j(t),e),e.sheet}function N(t,e,n){t.insertBefore(e,n||null)}function P(t){t.parentNode&&t.parentNode.removeChild(t)}function R(t){return document.createElement(t)}function q(t){return document.createTextNode(t)}function F(){return q(" ")}function Y(t,e,n,o){return t.addEventListener(e,n,o),()=>t.removeEventListener(e,n,o)}function X(t,e,n){null==n?t.removeAttribute(e):t.getAttribute(e)!==n&&t.setAttribute(e,n)}function B(t){return""===t?null:+t}function D(t,e){e=""+e,t.data!==e&&(t.data=e)}function H(t,e){t.value=null==e?"":e}function Q(t,e,n){t.classList.toggle(e,!!n)}function J(t,e,{bubbles:n=!1,cancelable:o=!1}={}){return new CustomEvent(t,{detail:e,bubbles:n,cancelable:o})}const U=new Map;let V,G=0;function K(t,e,n,o,i,s,r,l=0){const a=16.666/o;let c="{\n";for(let t=0;t<=1;t+=a){const o=e+(n-e)*s(t);c+=100*t+`%{${r(o,1-o)}}\n`}const u=c+`100% {${r(n,1-n)}}\n}`,d=`__svelte_${function(t){let e=5381,n=t.length;for(;n--;)e=(e<<5)-e^t.charCodeAt(n);return e>>>0}(u)}_${l}`,p=j(t),{stylesheet:f,rules:h}=U.get(p)||function(t,e){const n={stylesheet:W(e),rules:{}};return U.set(t,n),n}(p,t);h[d]||(h[d]=!0,f.insertRule(`@keyframes ${d} ${u}`,f.cssRules.length));const m=t.style.animation||"";return t.style.animation=`${m?`${m}, `:""}${d} ${o}ms linear ${i}ms 1 both`,G+=1,d}function Z(t,e){const n=(t.style.animation||"").split(", "),o=n.filter(e?t=>t.indexOf(e)<0:t=>-1===t.indexOf("__svelte")),i=n.length-o.length;i&&(t.style.animation=o.join(", "),G-=i,G||T((()=>{G||(U.forEach((t=>{const{ownerNode:e}=t.stylesheet;e&&P(e)})),U.clear())})))}function tt(t){V=t}function et(){if(!V)throw new Error("Function called outside component initialization");return V}function nt(t){et().$$.on_mount.push(t)}function ot(){const t=et();return(e,n,{cancelable:o=!1}={})=>{const i=t.$$.callbacks[e];if(i){const s=J(e,n,{cancelable:o});return i.slice().forEach((e=>{e.call(t,s)})),!s.defaultPrevented}return!0}}function it(t,e){return et().$$.context.set(t,e),e}function st(t){return et().$$.context.get(t)}const rt=[],lt=[];let at=[];const ct=[],ut=Promise.resolve();let dt=!1;function pt(t){at.push(t)}function ft(t){ct.push(t)}const ht=new Set;let mt,$t=0;function gt(){if(0!==$t)return;const t=V;do{try{for(;$t<rt.length;){const t=rt[$t];$t++,tt(t),bt(t.$$)}}catch(t){throw rt.length=0,$t=0,t}for(tt(null),rt.length=0,$t=0;lt.length;)lt.pop()();for(let t=0;t<at.length;t+=1){const e=at[t];ht.has(e)||(ht.add(e),e())}at.length=0}while(rt.length);for(;ct.length;)ct.pop()();dt=!1,ht.clear(),tt(t)}function bt(t){if(null!==t.fragment){t.update(),v(t.before_update);const e=t.dirty;t.dirty=[-1],t.fragment&&t.fragment.p(t.ctx,e),t.after_update.forEach(pt)}}function vt(){return mt||(mt=Promise.resolve(),mt.then((()=>{mt=null}))),mt}function yt(t,e,n){t.dispatchEvent(J(`${e?"intro":"outro"}${n}`))}const wt=new Set;let _t;function xt(){_t={r:0,c:[],p:_t}}function kt(){_t.r||v(_t.c),_t=_t.p}function Et(t,e){t&&t.i&&(wt.delete(t),t.i(e))}function Lt(t,e,n,o){if(t&&t.o){if(wt.has(t))return;wt.add(t),_t.c.push((()=>{wt.delete(t),o&&(n&&t.d(1),o())})),t.o(e)}else o&&o()}const Tt={duration:0};function zt(t,e,n,o){let i,s=e(t,n,{direction:"both"}),r=o?0:1,l=null,a=null,c=null;function u(){c&&Z(t,c)}function d(t,e){const n=t.b-r;return e*=Math.abs(n),{a:r,b:t.b,d:n,duration:e,start:t.start,end:t.start+e,group:t.group}}function p(e){const{delay:n=0,duration:o=300,easing:p=m,tick:f=h,css:$}=s||Tt,g={start:L()+n,b:e};e||(g.group=_t,_t.r+=1),"inert"in t&&(e?void 0!==i&&(t.inert=i):(i=t.inert,t.inert=!0)),l||a?a=g:($&&(u(),c=K(t,r,e,o,n,p,$)),e&&f(0,1),l=d(g,o),pt((()=>yt(t,e,"start"))),M((e=>{if(a&&e>a.start&&(l=d(a,o),a=null,yt(t,l.b,"start"),$&&(u(),c=K(t,r,l.b,l.duration,0,p,s.css))),l)if(e>=l.end)f(r=l.b,1-r),yt(t,l.b,"end"),a||(l.b?u():--l.group.r||v(l.group.c)),l=null;else if(e>=l.start){const t=e-l.start;r=l.a+l.d*p(t/l.duration),f(r,1-r)}return!(!l&&!a)})))}return{run(t){y(s)?vt().then((()=>{s=s({direction:t?"in":"out"}),p(t)})):p(t)},end(){u(),l=a=null}}}function At(t){return void 0!==t?.length?t:Array.from(t)}function Mt(t,e){t.d(1),e.delete(t.key)}function Ot(t,e){Lt(t,1,1,(()=>{e.delete(t.key)}))}function Ct(t,e,n,o,i,s,r,l,a,c,u,d){let p=t.length,f=s.length,h=p;const m={};for(;h--;)m[t[h].key]=h;const $=[],g=new Map,b=new Map,y=[];for(h=f;h--;){const t=d(i,s,h),l=n(t);let a=r.get(l);a?o&&y.push((()=>a.p(t,e))):(a=c(l,t),a.c()),g.set(l,$[h]=a),l in m&&b.set(l,Math.abs(h-m[l]))}const w=new Set,_=new Set;function x(t){Et(t,1),t.m(l,u),r.set(t.key,t),u=t.first,f--}for(;p&&f;){const e=$[f-1],n=t[p-1],o=e.key,i=n.key;e===n?(u=e.first,p--,f--):g.has(i)?!r.has(o)||w.has(o)?x(e):_.has(i)?p--:b.get(o)>b.get(i)?(_.add(o),x(e)):(w.add(i),p--):(a(n,r),p--)}for(;p--;){const e=t[p];g.has(e.key)||a(e,r)}for(;f;)x($[f-1]);return v(y),$}let It;function St(t,e,n){const o=t.$$.props[e];void 0!==o&&(t.$$.bound[o]=n,n(t.$$.ctx[o]))}function jt(t){t&&t.c()}function Wt(t,e,n){const{fragment:o,after_update:i}=t.$$;o&&o.m(e,n),pt((()=>{const e=t.$$.on_mount.map(g).filter(y);t.$$.on_destroy?t.$$.on_destroy.push(...e):v(e),t.$$.on_mount=[]})),i.forEach(pt)}function Nt(t,e){const n=t.$$;null!==n.fragment&&(function(t){const e=[],n=[];at.forEach((o=>-1===t.indexOf(o)?e.push(o):n.push(o))),n.forEach((t=>t())),at=e}(n.after_update),v(n.on_destroy),n.fragment&&n.fragment.d(e),n.on_destroy=n.fragment=null,n.ctx=[])}function Pt(t,e,n,o,i,s,r=null,l=[-1]){const a=V;tt(t);const c=t.$$={fragment:null,ctx:[],props:s,update:h,not_equal:i,bound:b(),on_mount:[],on_destroy:[],on_disconnect:[],before_update:[],after_update:[],context:new Map(e.context||(a?a.$$.context:[])),callbacks:b(),dirty:l,skip_bound:!1,root:e.target||a.$$.root};r&&r(c.root);let u=!1;if(c.ctx=n?n(t,e.props||{},((e,n,...o)=>{const s=o.length?o[0]:n;return c.ctx&&i(c.ctx[e],c.ctx[e]=s)&&(!c.skip_bound&&c.bound[e]&&c.bound[e](s),u&&function(t,e){-1===t.$$.dirty[0]&&(rt.push(t),dt||(dt=!0,ut.then(gt)),t.$$.dirty.fill(0)),t.$$.dirty[e/31|0]|=1<<e%31}(t,e)),n})):[],c.update(),u=!0,v(c.before_update),c.fragment=!!o&&o(c.ctx),e.target){if(e.hydrate){I=!0;const t=(d=e.target,Array.from(d.childNodes));c.fragment&&c.fragment.l(t),t.forEach(P)}else c.fragment&&c.fragment.c();e.intro&&Et(t.$$.fragment),Wt(t,e.target,e.anchor),I=!1,gt()}var d;tt(a)}function Rt(t,e,n,o){const i=n[t]?.type;if(e="Boolean"===i&&"boolean"!=typeof e?null!=e:e,!o||!n[t])return e;if("toAttribute"===o)switch(i){case"Object":case"Array":return null==e?null:JSON.stringify(e);case"Boolean":return e?"":null;case"Number":return null==e?null:e;default:return e}else switch(i){case"Object":case"Array":return e&&JSON.parse(e);case"Boolean":default:return e;case"Number":return null!=e?+e:e}}new Set(["allowfullscreen","allowpaymentrequest","async","autofocus","autoplay","checked","controls","default","defer","disabled","formnovalidate","hidden","inert","ismap","loop","multiple","muted","nomodule","novalidate","open","playsinline","readonly","required","reversed","selected"]),"function"==typeof HTMLElement&&(It=class extends HTMLElement{$$ctor;$$s;$$c;$$cn=!1;$$d={};$$r=!1;$$p_d={};$$l={};$$l_u=new Map;constructor(t,e,n){super(),this.$$ctor=t,this.$$s=e,n&&this.attachShadow({mode:"open"})}addEventListener(t,e,n){if(this.$$l[t]=this.$$l[t]||[],this.$$l[t].push(e),this.$$c){const n=this.$$c.$on(t,e);this.$$l_u.set(e,n)}super.addEventListener(t,e,n)}removeEventListener(t,e,n){if(super.removeEventListener(t,e,n),this.$$c){const t=this.$$l_u.get(e);t&&(t(),this.$$l_u.delete(e))}}async connectedCallback(){if(this.$$cn=!0,!this.$$c){if(await Promise.resolve(),!this.$$cn||this.$$c)return;function t(t){return()=>{let e;return{c:function(){e=R("slot"),"default"!==t&&X(e,"name",t)},m:function(t,n){N(t,e,n)},d:function(t){t&&P(e)}}}}const e={},n=function(t){const e={};return t.childNodes.forEach((t=>{e[t.slot||"default"]=!0})),e}(this);for(const i of this.$$s)i in n&&(e[i]=[t(i)]);for(const s of this.attributes){const r=this.$$g_p(s.name);r in this.$$d||(this.$$d[r]=Rt(r,s.value,this.$$p_d,"toProp"))}for(const l in this.$$p_d)l in this.$$d||void 0===this[l]||(this.$$d[l]=this[l],delete this[l]);this.$$c=new this.$$ctor({target:this.shadowRoot||this,props:{...this.$$d,$$slots:e,$$scope:{ctx:[]}}});const o=()=>{this.$$r=!0;for(const t in this.$$p_d)if(this.$$d[t]=this.$$c.$$.ctx[this.$$c.$$.props[t]],this.$$p_d[t].reflect){const e=Rt(t,this.$$d[t],this.$$p_d,"toAttribute");null==e?this.removeAttribute(this.$$p_d[t].attribute||t):this.setAttribute(this.$$p_d[t].attribute||t,e)}this.$$r=!1};this.$$c.$$.after_update.push(o),o();for(const a in this.$$l)for(const c of this.$$l[a]){const u=this.$$c.$on(a,c);this.$$l_u.set(c,u)}this.$$l={}}}attributeChangedCallback(t,e,n){this.$$r||(t=this.$$g_p(t),this.$$d[t]=Rt(t,n,this.$$p_d,"toProp"),this.$$c?.$set({[t]:this.$$d[t]}))}disconnectedCallback(){this.$$cn=!1,Promise.resolve().then((()=>{!this.$$cn&&this.$$c&&(this.$$c.$destroy(),this.$$c=void 0)}))}$$g_p(t){return Object.keys(this.$$p_d).find((e=>this.$$p_d[e].attribute===t||!this.$$p_d[e].attribute&&e.toLowerCase()===t))||t}});class qt{$$=void 0;$$set=void 0;$destroy(){Nt(this,1),this.$destroy=h}$on(t,e){if(!y(e))return h;const n=this.$$.callbacks[t]||(this.$$.callbacks[t]=[]);return n.push(e),()=>{const t=n.indexOf(e);-1!==t&&n.splice(t,1)}}$set(t){var e;this.$$set&&(e=t,0!==Object.keys(e).length)&&(this.$$.skip_bound=!0,this.$$set(t),this.$$.skip_bound=!1)}}function Ft(t){const e=t-1;return e*e*e+1}function Yt(t,{delay:e=0,duration:n=200,easing:o=Ft,side:i="bottom"}){if(n<=0)return!1;const s=getComputedStyle(t),r=t.offsetHeight;if(r<=0)return!1;let l;switch(i){case"top":l=[s.marginTop,s.marginBottom];break;case"bottom":l=[s.marginBottom,s.marginTop];break;case"left":l=[s.marginLeft,s.marginRight];break;case"right":l=[s.marginRight,s.marginLeft];break;default:return!1}l[0]=parseFloat(l[0])||0,l[1]=parseFloat(l[1])||0;const a=r+l[0]+l[1];return{delay:e,duration:n,easing:o,css:function(t,e){const n=l[0]-a*e;return`margin-${i}: ${n}px; opacity: ${t}; z-index: 0;`}}}function Xt(t){let e;return{c(){e=R("select"),X(e,"name",t[0]),e.multiple=t[1],e.disabled=t[2]},m(n,o){N(n,e,o),t[8](e)},p(t,[n]){1&n&&X(e,"name",t[0]),2&n&&(e.multiple=t[1]),4&n&&(e.disabled=t[2])},i:h,o:h,d(n){n&&P(e),t[8](null)}}}function Bt(t,n,o){let{handler:i}=n,{name:s=null}=n,{data:r=[]}=n,{multiple:l=!1}=n,{disabled:a=!1}=n,{placeholder:c=null}=n,{options:u={}}=n;const d=ot();let p,f=!1;var h;return nt((()=>{if(o(4,i=jQuery(p)),i.addClass("wc-enhanced-select"),i.data("data",r),i.data("placeholder",c),i.data("width","resolve"),u&&i.data(u),!1!==u.init&&e(!0!==u.init),i.on("change",(t=>{d("change",{handler:i,event:t})})),i.on("select2:close",(()=>{i.data("select2").$container.removeClass("select2-container--above"),i.data("select2").$dropdown.find("> .select2-dropdown").removeClass("select2-dropdown--above")})),l||i.on("select2:open",(()=>{const t=i.data("select2").$dropdown.find(".select2-search__field");t.one("blur",(()=>{setTimeout((()=>t.focus()),10)}))})),u.fixPosition){let t=!1;i.on("select2:open",(()=>{t||(i.selectWoo("close"),t=!0,i.selectWoo("open"),t=!1)}))}setTimeout((()=>{f=!0}))})),h=()=>{i.selectWoo("destroy"),i.remove()},et().$$.on_destroy.push(h),t.$$set=t=>{"handler"in t&&o(4,i=t.handler),"name"in t&&o(0,s=t.name),"data"in t&&o(5,r=t.data),"multiple"in t&&o(1,l=t.multiple),"disabled"in t&&o(2,a=t.disabled),"placeholder"in t&&o(6,c=t.placeholder),"options"in t&&o(7,u=t.options)},t.$$.update=()=>{var e;32&t.$$.dirty&&function(t){if(!f)return;if(u.replaceData||!t||!i.data("data")||t.length!==i.data("data").length||t.length&&t[0].id!==i.data("data")[0].id)return i.empty().trigger("change.select2"),i.data("data",t),void i.selectWoo();let e=!1;i.find("option").each(((n,o)=>{if(!t[n])return!1;const i=jQuery(o),s=!0===t[n].selected,r=!0===t[n].disabled;i.prop("selected")!==s&&(i.prop("selected",s),e=!0),i.prop("disabled")!==r&&(i.prop("disabled",r),e=!0)})),e&&(i.trigger("change.select2"),i.selectWoo())}(r),64&t.$$.dirty&&(e=c,f&&(i.data("placeholder",e),i.selectWoo())),128&t.$$.dirty&&function(t){f&&t&&(i.data(t),i.selectWoo())}(u)},[s,l,a,p,i,r,c,u,function(t){lt[t?"unshift":"push"]((()=>{p=t,o(3,p)}))}]}"undefined"!=typeof window&&(window.__svelte||(window.__svelte={v:new Set})).v.add("4");const Dt=class extends qt{constructor(t){super(),Pt(this,t,Bt,Xt,_,{handler:4,name:0,data:5,multiple:1,disabled:2,placeholder:6,options:7})}};function Ht(t,e,n){const o=t.slice();return o[13]=e[n],o[15]=n,o}function Qt(t){let e,n=t[13].image+"";return{c(){e=R("div"),X(e,"class","component-image")},m(t,o){N(t,e,o),e.innerHTML=n},p(t,o){4&o&&n!==(n=t[13].image+"")&&(e.innerHTML=n)},d(t){t&&P(e)}}}function Jt(t){let e,n,o=t[13].sku+"";return{c(){e=R("div"),n=q(o),X(e,"class","component-sku")},m(t,o){N(t,e,o),S(e,n)},p(t,e){4&e&&o!==(o=t[13].sku+"")&&D(n,o)},d(t){t&&P(e)}}}function Ut(t){let e,n,o;return{c(){e=R("div"),n=R("span"),X(n,"class","component-disabled"),X(n,"title",o=t[5].disabled),X(e,"class","component-status")},m(t,o){N(t,e,o),S(e,n)},p:h,d(t){t&&P(e)}}}function Vt(t,e){let n,o,i,s,r,l,a,c,u,d,p,f,h,m,$,g,b,y,w,_,x,k=e[13].title+"",E=e[13].image&&Qt(e),L=e[13].sku&&Jt(e),T=!e[13].enabled&&Ut(e);function z(){return e[9](e[13])}return{key:t,first:null,c(){n=R("div"),E&&E.c(),o=F(),i=R("div"),s=q(k),r=F(),L&&L.c(),l=F(),T&&T.c(),a=F(),c=R("div"),u=R("input"),h=F(),m=R("div"),$=R("button"),b=F(),X(i,"class","component-title"),X(u,"type","number"),X(u,"name",d=e[4].name+"["+e[1]+"]["+e[13].id+"]"),u.value=p=e[0][e[13].id],X(u,"step","any"),X(u,"min","0"),X(u,"placeholder",e[6]),X(u,"title",f=e[5][e[1]].quantityTip),X(c,"class","component-quantity"),X($,"type","button"),X($,"class","remove-component-button"),X($,"title",g=e[5].remove),X(m,"class","component-actions"),X(n,"class","component-item"),Q(n,"disabled",!e[13].enabled),this.first=n},m(t,e){N(t,n,e),E&&E.m(n,null),S(n,o),S(n,i),S(i,s),S(n,r),L&&L.m(n,null),S(n,l),T&&T.m(n,null),S(n,a),S(n,c),S(c,u),S(n,h),S(n,m),S(m,$),S(n,b),w=!0,_||(x=[Y(u,"change",Zt),Y($,"click",z),Y(n,"introend",Kt)],_=!0)},p(t,i){(e=t)[13].image?E?E.p(e,i):(E=Qt(e),E.c(),E.m(n,o)):E&&(E.d(1),E=null),(!w||4&i)&&k!==(k=e[13].title+"")&&D(s,k),e[13].sku?L?L.p(e,i):(L=Jt(e),L.c(),L.m(n,l)):L&&(L.d(1),L=null),e[13].enabled?T&&(T.d(1),T=null):T?T.p(e,i):(T=Ut(e),T.c(),T.m(n,a)),(!w||6&i&&d!==(d=e[4].name+"["+e[1]+"]["+e[13].id+"]"))&&X(u,"name",d),(!w||5&i&&p!==(p=e[0][e[13].id])&&u.value!==p)&&(u.value=p),(!w||2&i&&f!==(f=e[5][e[1]].quantityTip))&&X(u,"title",f),(!w||4&i)&&Q(n,"disabled",!e[13].enabled)},i(t){w||(t&&pt((()=>{w&&(y||(y=zt(n,Yt,{duration:170},!0)),y.run(1))})),w=!0)},o(t){t&&(y||(y=zt(n,Yt,{duration:170},!1)),y.run(0)),w=!1},d(t){t&&P(n),E&&E.d(),L&&L.d(),T&&T.d(),t&&y&&y.end(),_=!1,v(x)}}}function Gt(t){let e,n,o,i,s,r,l,a,c,u,d,p,f,h,m,$=t[5][t[1]].label+"",g=[],b=new Map;a=new Dt({props:{multiple:!0,data:t[3],placeholder:t[5][t[1]].addPlaceholder,options:{width:"auto"}}}),a.$on("change",t[7]);let v=At(t[2]);const y=t=>t[13].id;for(let e=0;e<v.length;e+=1){let n=Ht(t,v,e),o=y(n);b.set(o,g[e]=Vt(o,n))}return{c(){e=R("p"),n=R("label"),o=q($),i=F(),s=R("span"),l=F(),jt(a.$$.fragment),u=F(),d=R("div"),p=R("div"),f=R("div");for(let t=0;t<g.length;t+=1)g[t].c();X(n,"for",""),X(s,"class","woocommerce-help-tip"),X(s,"title",r=t[5][t[1]].fieldTip),X(e,"class",c="form-field mewz_wcas_"+t[1]+"_components_field"),X(f,"class","component-list-inner"),X(p,"class",h="component-list "+t[1]+"-component-list"),X(d,"class","mewz-wcas-components-section"),Q(d,"empty",!t[2].length)},m(t,r){N(t,e,r),S(e,n),S(n,o),S(e,i),S(e,s),S(e,l),Wt(a,e,null),N(t,u,r),N(t,d,r),S(d,p),S(p,f);for(let t=0;t<g.length;t+=1)g[t]&&g[t].m(f,null);m=!0},p(t,[n]){(!m||2&n)&&$!==($=t[5][t[1]].label+"")&&D(o,$),(!m||2&n&&r!==(r=t[5][t[1]].fieldTip))&&X(s,"title",r);const i={};8&n&&(i.data=t[3]),2&n&&(i.placeholder=t[5][t[1]].addPlaceholder),a.$set(i),(!m||2&n&&c!==(c="form-field mewz_wcas_"+t[1]+"_components_field"))&&X(e,"class",c),375&n&&(v=At(t[2]),xt(),g=Ct(g,n,y,1,t,v,b,f,Ot,Vt,null,Ht),kt()),(!m||2&n&&h!==(h="component-list "+t[1]+"-component-list"))&&X(p,"class",h),(!m||4&n)&&Q(d,"empty",!t[2].length)},i(t){if(!m){Et(a.$$.fragment,t);for(let t=0;t<v.length;t+=1)Et(g[t]);m=!0}},o(t){Lt(a.$$.fragment,t);for(let t=0;t<g.length;t+=1)Lt(g[t]);m=!1},d(t){t&&(P(e),P(u),P(d)),Nt(a);for(let t=0;t<g.length;t+=1)g[t].d()}}}function Kt(t){t.target.scrollIntoView({behavior:"smooth",block:"nearest"})}function Zt(t){+t.target.value<=0&&(t.target.value="")}function te(t,e,n){let o,i,{type:s}=e,{components:r}=e;const l=st("data"),{i18n:a}=l,c=ot(),u=1..toLocaleString(l.locale,{minimumFractionDigits:2});function d(t){delete r[t],n(0,r)}return t.$$set=t=>{"type"in t&&n(1,s=t.type),"components"in t&&n(0,r=t.components)},t.$$.update=()=>{1&t.$$.dirty&&n(3,o=function(t){const e=[];for(const n of l.stockList){let o=n.title;n.sku&&(o+=` [${n.sku}]`),n.enabled||(o=`🛇 ${o}`);const i={id:n.id,text:o};n.id in t&&(i.disabled=!0),e.push(i)}return e}(r)),1&t.$$.dirty&&n(2,i=l.stockList.filter((t=>t.id in r)))},[r,s,i,o,l,a,u,function(t){const e=t.detail.handler,o=e.val();var i;o&&o.length&&((i=+o[0])in r||(n(0,r[i]=["",""],r),c("added",{type:s,id:i})),setTimeout((()=>e.focus())))},d,t=>d(t.id)]}const ee=class extends qt{constructor(t){super(),Pt(this,t,te,Gt,w,{type:1,components:0})}};function ne(t){let e;return{c(){e=R("input"),X(e,"type","hidden"),X(e,"name","mewz_wcas_noupdate[components]"),e.value="1"},m(t,n){N(t,e,n)},d(t){t&&P(e)}}}function oe(t){let e,n,o,i,s,r,l,a,c,u=!t[1]&&ne();function d(e){t[3](e)}let p={type:"parent"};function f(e){t[4](e)}void 0!==t[0].parent&&(p.components=t[0].parent),o=new ee({props:p}),lt.push((()=>St(o,"components",d))),o.$on("added",t[2]);let h={type:"child"};return void 0!==t[0].child&&(h.components=t[0].child),l=new ee({props:h}),lt.push((()=>St(l,"components",f))),l.$on("added",t[2]),{c(){u&&u.c(),e=F(),n=R("div"),jt(o.$$.fragment),s=F(),r=R("div"),jt(l.$$.fragment),X(n,"class","options_group"),X(r,"class","options_group")},m(t,i){u&&u.m(t,i),N(t,e,i),N(t,n,i),Wt(o,n,null),N(t,s,i),N(t,r,i),Wt(l,r,null),c=!0},p(t,[n]){t[1]?u&&(u.d(1),u=null):u||(u=ne(),u.c(),u.m(e.parentNode,e));const s={};!i&&1&n&&(i=!0,s.components=t[0].parent,ft((()=>i=!1))),o.$set(s);const r={};!a&&1&n&&(a=!0,r.components=t[0].child,ft((()=>a=!1))),l.$set(r)},i(t){c||(Et(o.$$.fragment,t),Et(l.$$.fragment,t),c=!0)},o(t){Lt(o.$$.fragment,t),Lt(l.$$.fragment,t),c=!1},d(t){t&&(P(e),P(n),P(s),P(r)),u&&u.d(t),Nt(o),Nt(l)}}}function ie(t,e,i){const s=e.data,r=s.components;it("data",s);let l=!1;s.stockItems={};for(const t of s.stockList)s.stockItems[t.id]=t;return nt((()=>{setTimeout((()=>{n("#components_panel .woocommerce-help-tip"),o(document.getElementById("components_panel"),s.name+"[",(t=>i(1,l=t)))}))})),t.$$set=t=>{i(6,e=$($({},e),x(t)))},t.$$.update=()=>{1&t.$$.dirty&&mewzWcas.setTabIndicator("components",Object.values(r.child).length)},e=x(e),[r,l,function(t){const{type:e,id:n}=t.detail;delete r["parent"===e?"child":"parent"][n]},function(e){t.$$.not_equal(r.parent,e)&&(r.parent=e,i(0,r))},function(e){t.$$.not_equal(r.child,e)&&(r.child=e,i(0,r))}]}function se(t,{delay:e=0,duration:n=400,easing:o=Ft,axis:i="y"}={}){const s=getComputedStyle(t),r=+s.opacity,l="y"===i?"height":"width",a=parseFloat(s[l]),c="y"===i?["top","bottom"]:["left","right"],u=c.map((t=>`${t[0].toUpperCase()}${t.slice(1)}`)),d=parseFloat(s[`padding${u[0]}`]),p=parseFloat(s[`padding${u[1]}`]),f=parseFloat(s[`margin${u[0]}`]),h=parseFloat(s[`margin${u[1]}`]),m=parseFloat(s[`border${u[0]}Width`]),$=parseFloat(s[`border${u[1]}Width`]);return{delay:e,duration:n,easing:o,css:t=>`overflow: hidden;opacity: ${Math.min(20*t,1)*r};${l}: ${t*a}px;padding-${c[0]}: ${t*d}px;padding-${c[1]}: ${t*p}px;margin-${c[0]}: ${t*f}px;margin-${c[1]}: ${t*h}px;border-${c[0]}-width: ${t*m}px;border-${c[1]}-width: ${t*$}px;`}}function re(t,e){e=Object.assign({open:!0,duration:.2,easing:"ease"},e);const n=()=>{};let o=n,i=n;const s=t.addEventListener("transitionend",(()=>{o(),o=n,i=n}));async function r(){return new Promise(requestAnimationFrame)}function l(){return`height ${e.duration}s ${e.easing}`}return t.style.transition=l(),t.style.height=e.open?"auto":"0px",e.open?t.style.overflow="visible":t.style.overflow="hidden",{update:function(n){(e=Object.assign(e,n)).open?async function(){t.style.height=t.scrollHeight+"px";try{await async function(){return new Promise(((t,e)=>{o=t,i=e}))}(),t.style.height="auto",t.style.overflow="visible"}catch(t){}}():async function(){"auto"===t.style.height?(t.style.transition="none",await r(),t.style.height=t.scrollHeight+"px",t.style.transition=l(),await r(),t.style.overflow="hidden",t.style.height="0px"):(i(),t.style.overflow="hidden",t.style.height="0px")}()},destroy:function(){t.removeEventListener("transitionend",s)}}}function le(t,{dragStart:e,dragMove:n,dragEnd:o,exclude:i,enabled:s=!0}){function r(t){if(!s||i&&t.target.closest(i))return;const r=ae(t);r&&(t.preventDefault(),function(t,e,{dragStart:n,dragMove:o,dragEnd:i}){let s,r=t,l=e.clientX,a=e.clientY,c=l+window.scrollX,u=a+window.scrollY,d=0,p=0;function f(t){const e=ae(t);e&&(r=t,l=e.clientX,a=e.clientY,d=l+window.scrollX-c,p=a+window.scrollY-u,o&&o({event:t,pointer:e,x:l,y:top,startX:c,startY:u,moveX:d,moveY:p}))}function h(t){const e=ae(t,s);e&&(r=t,"mouseup"===t.type?(window.removeEventListener("mousemove",f),window.removeEventListener("mouseup",h)):(window.removeEventListener("touchmove",f),window.removeEventListener("touchend",h)),window.removeEventListener("scroll",m),i&&i({event:t,pointer:e,x:l,y:top,startX:c,startY:u,moveX:d,moveY:p}))}function m(){d=l+window.scrollX-c,p=a+window.scrollY-u,o({event:r,pointer:e,x:l,y:top,startX:c,startY:u,moveX:d,moveY:p})}"mousedown"===t.type?(window.addEventListener("mousemove",f),window.addEventListener("mouseup",h)):(s=e.identifier,window.addEventListener("touchmove",f),window.addEventListener("touchend",h)),window.addEventListener("scroll",m),n&&n({event:t,pointer:e,x:l,y:top,startX:c,startY:u})}(t,r,{dragStart:e,dragMove:n,dragEnd:o}))}return t.addEventListener("mousedown",r),t.addEventListener("touchstart",r,{passive:!1}),{update(t){i=t.exclude,s=t.enabled},destroy(){t.removeEventListener("mousedown",r),t.removeEventListener("touchstart",r)}}}function ae(t,e){return t instanceof MouseEvent?0===t.button?t:null:void 0===e?1===t.touches.length?t.touches[0]:null:function(t,e){for(const n of t)if(n.identifier===e)return n;return null}(t.changedTouches,e)}function ce(t,e,n){const o=t.slice();o[43]=e[n],o[45]=e,o[46]=n;const i=`${o[8].name}[${o[3]}][attributes][${o[43][0]}]`;return o[44]=i,o}function ue(t,e,n){const o=t.slice();return o[47]=e[n],o[49]=n,o}function de(t){let e,n,o,i,s=t[9].ruleTitle.replace("%s",t[3]+1)+"";return{c(){e=R("span"),n=q(s),o=F(),i=R("span"),i.textContent="—",X(e,"class","toolbar-label toolbar-label-title"),X(i,"class","sep")},m(t,s){N(t,e,s),S(e,n),N(t,o,s),N(t,i,s)},p(t,e){8&e[0]&&s!==(s=t[9].ruleTitle.replace("%s",t[3]+1)+"")&&D(n,s)},d(t){t&&(P(e),P(o),P(i))}}}function pe(t){let e,n,o=t[47].name+"";return{c(){e=R("span"),n=q(o),X(e,"class","name")},m(t,o){N(t,e,o),S(e,n)},p(t,e){3&e[0]&&o!==(o=t[47].name+"")&&D(n,o)},d(t){t&&P(e)}}}function fe(t,e){let n,o,i,s,r,l,a,c,u=(e[47].value||"")+"",d=e[47].name&&pe(e);return{key:t,first:null,c(){n=R("span"),d&&d.c(),o=F(),i=R("span"),s=q(u),r=F(),X(i,"class","value"),X(n,"class",l="toolbar-label toolbar-label-"+e[47].type+(e[47].class?" "+e[47].class:"")),X(n,"title",a=e[47].title),X(n,"rel",c=e[47].title?"tiptip":null),this.first=n},m(t,e){N(t,n,e),d&&d.m(n,null),S(n,o),S(n,i),S(i,s),S(n,r)},p(t,i){(e=t)[47].name?d?d.p(e,i):(d=pe(e),d.c(),d.m(n,o)):d&&(d.d(1),d=null),3&i[0]&&u!==(u=(e[47].value||"")+"")&&D(s,u),3&i[0]&&l!==(l="toolbar-label toolbar-label-"+e[47].type+(e[47].class?" "+e[47].class:""))&&X(n,"class",l),3&i[0]&&a!==(a=e[47].title)&&X(n,"title",a),3&i[0]&&c!==(c=e[47].title?"tiptip":null)&&X(n,"rel",c)},d(t){t&&P(n),d&&d.d()}}}function he(t,e){let n,o,i,s,r,l,a,c,u,d,p,f,h,m,$,g,b,v,y,w;function _(){return e[28](e[46])}return s=new Dt({props:{data:e[12](e[43][0]),placeholder:{id:"",text:e[9].attributePlaceholder},options:{init:!0,fixPosition:!0}}}),s.$on("change",(function(...t){return e[26](e[43],e[45],e[46],...t)})),d=new Dt({props:{name:e[44]+"[]",multiple:!0,data:e[13](e[43]),placeholder:e[43][0]?e[9].anyOption.replace("%s",e[8].attributes[e[43][0]].label):e[9].termPlaceholder,disabled:!e[43][0],options:{init:!0,width:"auto",fixPosition:!0}}}),d.$on("change",(function(...t){return e[27](e[43],e[45],e[46],...t)})),{key:t,first:null,c(){n=R("div"),o=R("div"),i=R("div"),jt(s.$$.fragment),r=F(),l=R("div"),a=R("input"),u=F(),jt(d.$$.fragment),p=F(),f=R("div"),h=R("button"),g=F(),X(i,"class","select-attribute"),X(a,"type","hidden"),X(a,"name",c=e[44]),a.value="",X(l,"class","select-terms"),X(h,"type","button"),X(h,"class","icon-button row-remove-button"),X(h,"title",m=e[9].removeAttribute),h.disabled=$=1===e[0].length&&!e[43].attribute,X(f,"class","attribute-row-actions"),X(o,"class","attribute-row-inner"),X(n,"class","attribute-row"),this.first=n},m(t,e){N(t,n,e),S(n,o),S(o,i),Wt(s,i,null),S(o,r),S(o,l),S(l,a),S(l,u),Wt(d,l,null),S(o,p),S(o,f),S(f,h),S(n,g),v=!0,y||(w=Y(h,"click",_),y=!0)},p(t,n){e=t;const o={};1&n[0]&&(o.data=e[12](e[43][0])),s.$set(o),(!v||9&n[0]&&c!==(c=e[44]))&&X(a,"name",c);const i={};9&n[0]&&(i.name=e[44]+"[]"),1&n[0]&&(i.data=e[13](e[43])),1&n[0]&&(i.placeholder=e[43][0]?e[9].anyOption.replace("%s",e[8].attributes[e[43][0]].label):e[9].termPlaceholder),1&n[0]&&(i.disabled=!e[43][0]),d.$set(i),(!v||1&n[0]&&$!==($=1===e[0].length&&!e[43].attribute))&&(h.disabled=$)},i(t){v||(Et(s.$$.fragment,t),Et(d.$$.fragment,t),t&&pt((()=>{v&&(b||(b=zt(n,Yt,{duration:130},!0)),b.run(1))})),v=!0)},o(t){Lt(s.$$.fragment,t),Lt(d.$$.fragment,t),t&&(b||(b=zt(n,Yt,{duration:130},!1)),b.run(0)),v=!1},d(t){t&&P(n),Nt(s),Nt(d),t&&b&&b.end(),y=!1,w()}}}function me(t){let e,n,o,i,s,r;return{c(){e=R("div"),n=R("button"),n.textContent="Add attribute",X(n,"type","button"),X(n,"class","row-add-button"),X(e,"class","attribute-list-actions")},m(o,l){N(o,e,l),S(e,n),i=!0,s||(r=Y(n,"click",t[29]),s=!0)},p:h,i(t){i||(t&&pt((()=>{i&&(o||(o=zt(e,se,{duration:100},!0)),o.run(1))})),i=!0)},o(t){t&&(o||(o=zt(e,se,{duration:100},!1)),o.run(0)),i=!1},d(t){t&&P(e),t&&o&&o.end(),s=!1,r()}}}function $e(t){let e,n,o,i,s,r,l,a,c,u,d,p,f,$,g,b,w,_,x,E,T,z,A,O,C,I,j,W,D,J,U,V,G,tt,et,nt,ot,it,st,rt,lt,at,ct,ut=[],dt=new Map,ft=[],ht=new Map,mt=t[9].multiplierLabel+"",$t=t[5]>1&&de(t),gt=At(t[14](t[0],t[1]));const bt=t=>t[49]+t[47].type;for(let e=0;e<gt.length;e+=1){let n=ue(t,gt,e),o=bt(n);dt.set(o,ut[e]=fe(o,n))}let wt=At(t[0]);const zt=t=>t[43];for(let e=0;e<wt.length;e+=1){let n=ce(t,wt,e),o=zt(n);ht.set(o,ft[e]=he(o,n))}let It=t[0].length<t[10]&&me(t);return{c(){e=R("div"),n=R("div"),o=R("div"),$t&&$t.c(),i=F();for(let t=0;t<ut.length;t+=1)ut[t].c();s=F(),r=R("span"),l=R("span"),a=F(),c=R("button"),p=F(),f=R("button"),g=F(),b=R("button"),_=F(),x=R("div"),E=R("div"),T=R("div"),z=R("div");for(let t=0;t<ft.length;t+=1)ft[t].c();A=F(),It&&It.c(),O=F(),C=R("div"),I=R("div"),j=R("label"),W=q(mt),D=F(),J=R("span"),V=F(),G=R("input"),X(o,"class","toolbar-labels"),X(l,"class","toolbar-action icon-button expand-button"),X(c,"type","button"),X(c,"class","toolbar-action icon-button drag-button"),X(c,"title",u=t[9].dragTip),X(f,"type","button"),X(f,"class","toolbar-action icon-button duplicate-button"),X(f,"title",$=t[9].duplicateRule),X(b,"type","button"),X(b,"class","toolbar-action icon-button remove-button"),X(b,"title",w=t[9].removeRule),X(r,"class","match-rule-toolbar-actions"),X(n,"class","match-rule-toolbar"),X(z,"class","attribute-rows"),X(T,"class","attribute-list"),X(J,"class","woocommerce-help-tip"),X(J,"title",U=t[9].multiplierTip),X(G,"type","number"),X(G,"name",tt=t[17](t[3],"multiplier")),X(G,"step","any"),X(G,"min","-1"),X(G,"placeholder",et=t[22](t[0])),X(G,"lang",nt=t[8].locale),X(I,"class","option option-multiplier"),X(C,"class","match-rule-options"),X(E,"class","match-rule-body-inner"),X(x,"class","match-rule-body"),X(e,"class","mewz-wcas-match-rule"),X(e,"style",it=ge(t[7])),Q(e,"zero-multiplier",null!=t[1]&&""!==t[1]&&0==+t[1]),Q(e,"stop-rule",+t[1]<0),Q(e,"open",t[2]),Q(e,"dragging",t[7]),Q(e,"released",t[7]&&t[7].released)},m(u,h){N(u,e,h),S(e,n),S(n,o),$t&&$t.m(o,null),S(o,i);for(let t=0;t<ut.length;t+=1)ut[t]&&ut[t].m(o,null);S(n,s),S(n,r),S(r,l),S(r,a),S(r,c),S(r,p),S(r,f),S(r,g),S(r,b),S(e,_),S(e,x),S(x,E),S(E,T),S(T,z);for(let t=0;t<ft.length;t+=1)ft[t]&&ft[t].m(z,null);S(T,A),It&&It.m(T,null),S(E,O),S(E,C),S(C,I),S(I,j),S(j,W),S(j,D),S(j,J),S(I,V),S(I,G),H(G,t[1]),t[31](e),lt=!0,at||(ct=[k(d=le.call(null,c,{dragStart:t[19],dragMove:t[20],dragEnd:t[21],enabled:t[4]})),Y(f,"click",t[24]),Y(b,"click",t[25]),Y(n,"click",t[18]),Y(G,"input",t[30]),k(ot=re.call(null,x,{open:t[2],duration:.17}))],at=!0)},p(t,n){t[5]>1?$t?$t.p(t,n):($t=de(t),$t.c(),$t.m(o,i)):$t&&($t.d(1),$t=null),16387&n[0]&&(gt=At(t[14](t[0],t[1])),ut=Ct(ut,n,bt,1,t,gt,dt,o,Mt,fe,null,ue)),d&&y(d.update)&&16&n[0]&&d.update.call(null,{dragStart:t[19],dragMove:t[20],dragEnd:t[21],enabled:t[4]}),78601&n[0]&&(wt=At(t[0]),xt(),ft=Ct(ft,n,zt,1,t,wt,ht,z,Ot,he,null,ce),kt()),t[0].length<t[10]?It?(It.p(t,n),1&n[0]&&Et(It,1)):(It=me(t),It.c(),Et(It,1),It.m(T,null)):It&&(xt(),Lt(It,1,1,(()=>{It=null})),kt()),(!lt||8&n[0]&&tt!==(tt=t[17](t[3],"multiplier")))&&X(G,"name",tt),(!lt||1&n[0]&&et!==(et=t[22](t[0])))&&X(G,"placeholder",et),2&n[0]&&B(G.value)!==t[1]&&H(G,t[1]),ot&&y(ot.update)&&4&n[0]&&ot.update.call(null,{open:t[2],duration:.17}),(!lt||128&n[0]&&it!==(it=ge(t[7])))&&X(e,"style",it),(!lt||2&n[0])&&Q(e,"zero-multiplier",null!=t[1]&&""!==t[1]&&0==+t[1]),(!lt||2&n[0])&&Q(e,"stop-rule",+t[1]<0),(!lt||4&n[0])&&Q(e,"open",t[2]),(!lt||128&n[0])&&Q(e,"dragging",t[7]),(!lt||128&n[0])&&Q(e,"released",t[7]&&t[7].released)},i(t){if(!lt){for(let t=0;t<wt.length;t+=1)Et(ft[t]);Et(It),t&&pt((()=>{lt&&(rt&&rt.end(1),st=function(t,e,n){const o={direction:"in"};let i,s,r=e(t,{duration:170},o),l=!1,a=0;function c(){i&&Z(t,i)}function u(){const{delay:e=0,duration:n=300,easing:o=m,tick:u=h,css:d}=r||Tt;d&&(i=K(t,0,1,n,e,o,d,a++)),u(0,1);const p=L()+e,f=p+n;s&&s.abort(),l=!0,pt((()=>yt(t,!0,"start"))),s=M((e=>{if(l){if(e>=f)return u(1,0),yt(t,!0,"end"),c(),l=!1;if(e>=p){const t=o((e-p)/n);u(t,1-t)}}return l}))}let d=!1;return{start(){d||(d=!0,Z(t),y(r)?(r=r(o),vt().then(u)):u())},invalidate(){d=!1},end(){l&&(c(),l=!1)}}}(e,Yt),st.start())})),lt=!0}},o(t){for(let t=0;t<ft.length;t+=1)Lt(ft[t]);Lt(It),st&&st.invalidate(),t&&(rt=function(t,e,n){const o={direction:"out"};let i,s=e(t,{duration:170},o),r=!0;const l=_t;let a;function c(){const{delay:e=0,duration:n=300,easing:o=m,tick:c=h,css:u}=s||Tt;u&&(i=K(t,1,0,n,e,o,u));const d=L()+e,p=d+n;pt((()=>yt(t,!1,"start"))),"inert"in t&&(a=t.inert,t.inert=!0),M((e=>{if(r){if(e>=p)return c(0,1),yt(t,!1,"end"),--l.r||v(l.c),!1;if(e>=d){const t=o((e-d)/n);c(1-t,t)}}return r}))}return l.r+=1,y(s)?vt().then((()=>{s=s(o),c()})):c(),{end(e){e&&"inert"in t&&(t.inert=a),e&&s.tick&&s.tick(1,0),r&&(i&&Z(t,i),r=!1)}}}(e,Yt)),lt=!1},d(n){n&&P(e),$t&&$t.d();for(let t=0;t<ut.length;t+=1)ut[t].d();for(let t=0;t<ft.length;t+=1)ft[t].d();It&&It.d(),t[31](null),n&&rt&&rt.end(),at=!1,v(ct)}}}function ge(t){if(t)return`transform: translateY(${t.offset}px);`}function be(t,e,o){let i,{index:s}=e,{attributes:r}=e,{multiplier:l=""}=e,{mounted:a=!1}=e,{open:c=!0}=e,{draggable:u=!0}=e,{ruleCount:d=1}=e;const p=st("data"),f=p.i18n,h=Object.keys(p.attributes).length,m=ot(),$=k(1,!0);let g,b=!1;function v(){const t=[0,[]];r?(r.push(t),o(0,r)):o(0,r=[t]),a&&setTimeout((()=>{const t=g.querySelector(".attribute-row:last-child .select-attribute select");t&&jQuery(t).focus()}),150)}function y(t){r.splice(t,1),r.length?o(0,r):v()}function w(t){if(!t||t.target===g){b.released&&g.removeEventListener("transitionend",w);for(const t of b.list)t.el.style.transform="";m("dragging",[s,!1]),b.targetIndex!==s&&m("action",["shift",s,b.targetIndex]),o(7,b=!1)}}function _(){const t=g.parentNode.querySelectorAll(".mewz-wcas-match-rule"),e=[];let n=0;for(const o of t){const t=o.offsetHeight;e.push({el:o,height:t,mid:n+Math.round(t/2),offset:0}),n+=t}return e}function x(t){const e={};for(const n of t)e[n[0]]=n[1];for(const[t]of p.attributeOptions){const n=e[t];if(!n)continue;const o=p.attributes[t];if(1===n.length){for(const t of o.terms)if(t[0]===n[0]&&null!=t[2])return+t[2]}else{let t=[1/0,0],e=!1;for(const i of o.terms){if(n.length&&!n.includes(i[0]))continue;if(null==i[2]){e=!0;continue}const o=+i[2];o<t[0]&&(t[0]=o),o>t[1]&&(t[1]=o)}if(t[0]!==1/0)return e&&t[0]>1&&(t[0]=1),t[0]===t[1]?t[0]:t}}return null}function k(t,e){const n=e&&t<10?{minimumFractionDigits:2}:{maximumSignificantDigits:20,maximumFractionDigits:20};return t.toLocaleString(p.locale,n)}return nt((()=>{n(".mewz-wcas-match-rule .woocommerce-help-tip")})),t.$$set=t=>{"index"in t&&o(3,s=t.index),"attributes"in t&&o(0,r=t.attributes),"multiplier"in t&&o(1,l=t.multiplier),"mounted"in t&&o(23,a=t.mounted),"open"in t&&o(2,c=t.open),"draggable"in t&&o(4,u=t.draggable),"ruleCount"in t&&o(5,d=t.ruleCount)},t.$$.update=()=>{1&t.$$.dirty[0]&&(r.length||v()),1&t.$$.dirty[0]&&(i=function(t){const e={};for(const n of t)n[0]&&(e[n[0]]=!0);return e}(r))},[r,l,c,s,u,d,g,b,p,f,h,m,function(t){const e=[{id:"",text:""}];for(const[n,o]of p.attributeOptions){const s={id:n,text:o};n===t?s.selected=!0:i[n]&&(s.disabled=!0),e.push(s)}return e},function(t){if(!t[0])return[];const e=p.attributes[t[0]].terms,n=[],o={};for(const e of t[1])o[e]=!0;for(const[t,i]of e){const e={id:t,text:i};o[t]&&(e.selected=!0),n.push(e)}return n},function(t,e){const o=[];for(const[e,n]of t){if(!e||!n)continue;const t=[];if(n.length)for(const o of p.attributes[e].terms)if(n.includes(o[0])&&(t.push(o[1]),t.length===n.length))break;o.push({type:"attribute",name:p.attributes[e].label,value:t.length?t.join(", "):f.any})}if(o.length||o.push({type:"attribute",value:"..."}),null!=e&&""!==e&&1!=+e)+e<0?(o.push({type:"stop",title:f.stopRuleTip}),setTimeout((()=>n('.mewz-wcas-match-rule [rel="tiptip"]')))):o.push({type:"multiplier",value:`×${k(+e)}`});else if(1!=+e){const e=x(t);if(null!=e){let t;t=Array.isArray(e)?`×${k(e[0])}–${k(e[1])}`:`×${k(e)}`,o.push({type:"multiplier",class:"inherited",title:f.multiplierInherited,value:t})}}return o},v,y,function(t,e){return`${p.name}[${t}][${e}]`},function(t){b||t&&t.target.closest("button")||o(2,c=!c)},function(t){b||(o(7,b={height:g.offsetHeight,start:g.offsetTop,offset:0,end:g.parentNode.offsetHeight,list:_(),targetIndex:s,animatedIndex:s,released:!1}),m("dragging",[s,{released:!1}]))},function(t){b&&!b.released&&(o(7,b.offset=Math.max(-b.start,t.moveY),b),o(7,b.offset=Math.min(b.offset,b.end-b.start-b.height),b),o(7,b.targetIndex=function(){let t=s;const e=b.start+b.offset;for(let n=0;n<b.list.length;n++){const o=b.list[n].mid;if(n<s){if(e<o)return n}else n>s&&e+b.height>o&&(t=n)}return t}(),b),function(){if(b.targetIndex===b.animatedIndex)return;const t=b.targetIndex;for(let e=0;e<b.list.length;e++){const n=b.list[e];let o=0;t<s?e>=t&&e<s&&(o=b.height):t>s&&e<=t&&e>s&&(o=-b.height),n.offset!==o&&(n.el.style.transform=`translateY(${o}px)`,n.offset=o,null==n.animating&&n.el.addEventListener("transitionend",(()=>{n.animating=!1})),n.animating=!0)}o(7,b.animatedIndex=t,b)}())},function(){if(!b||b.released)return;const t=function(){const t=b.targetIndex;let e=0;if(t<s)for(let n=t;n<s;n++)e-=b.list[n].height;else if(t>s)for(let n=t;n>s;n--)e+=b.list[n].height;return e}();b.offset===t?b.targetIndex===s?(m("dragging",[s,!1]),o(7,b=!1)):b.list.some((t=>!0===t.animating))?(setTimeout(w,200),m("dragging",[s,{released:!0}])):w():(g.addEventListener("transitionend",w),o(7,b.offset=t,b),o(7,b.released=!0,b),m("dragging",[s,{released:!0}]))},function(t){const e=x(t);return null==e?$:Array.isArray(e)?k(e[0])+" – "+k(e[1]):k(e,!0)},a,()=>m("action",["duplicate",s]),()=>m("action",["remove",s]),(t,e,n,i)=>o(0,e[n][0]=+i.detail.handler.val(),r),(t,e,n,i)=>o(0,e[n][1]=i.detail.handler.val().map(Number),r),t=>y(t),()=>v(),function(){l=B(this.value),o(1,l)},function(t){lt[t?"unshift":"push"]((()=>{g=t,o(6,g)}))}]}const ve=class extends qt{constructor(t){super(),Pt(this,t,be,$e,w,{index:3,attributes:0,multiplier:1,mounted:23,open:2,draggable:4,ruleCount:5},null,[-1,-1])}};function ye(t,e,n){const o=t.slice();return o[26]=e[n],o[27]=e,o[28]=n,o}function we(t){let e,n,o,i;return{c(){e=R("button"),X(e,"type","button"),X(e,"class","button restore-button"),X(e,"title",n=t[1].i18n.restoreRule)},m(n,s){N(n,e,s),o||(i=Y(e,"click",t[11]),o=!0)},p(t,o){2&o&&n!==(n=t[1].i18n.restoreRule)&&X(e,"title",n)},d(t){t&&P(e),o=!1,i()}}}function _e(t,e){let n,o,i,s,r,l,a;function c(t){e[14](t)}function u(t){e[15](t,e[26])}function d(t){e[16](t,e[26])}function p(t){e[17](t,e[26])}let f={index:e[28],draggable:!e[6],ruleCount:e[0].length};return void 0!==e[5]&&(f.mounted=e[5]),void 0!==e[26].attributes&&(f.attributes=e[26].attributes),void 0!==e[26].multiplier&&(f.multiplier=e[26].multiplier),void 0!==e[26].open&&(f.open=e[26].open),o=new ve({props:f}),lt.push((()=>St(o,"mounted",c))),lt.push((()=>St(o,"attributes",u))),lt.push((()=>St(o,"multiplier",d))),lt.push((()=>St(o,"open",p))),o.$on("action",e[10]),o.$on("dragging",e[9]),{key:t,first:null,c(){n=q(""),jt(o.$$.fragment),this.first=n},m(t,e){N(t,n,e),Wt(o,t,e),a=!0},p(t,n){e=t;const a={};1&n&&(a.index=e[28]),64&n&&(a.draggable=!e[6]),1&n&&(a.ruleCount=e[0].length),!i&&32&n&&(i=!0,a.mounted=e[5],ft((()=>i=!1))),!s&&1&n&&(s=!0,a.attributes=e[26].attributes,ft((()=>s=!1))),!r&&1&n&&(r=!0,a.multiplier=e[26].multiplier,ft((()=>r=!1))),!l&&1&n&&(l=!0,a.open=e[26].open,ft((()=>l=!1))),o.$set(a)},i(t){a||(Et(o.$$.fragment,t),a=!0)},o(t){Lt(o.$$.fragment,t),a=!1},d(t){t&&P(n),Nt(o,t)}}}function xe(t){let e;return{c(){e=R("input"),X(e,"type","hidden"),X(e,"name","mewz_wcas_noupdate[rules]"),e.value="1"},m(t,n){N(t,e,n)},d(t){t&&P(e)}}}function ke(t){let e,n,o,i,s,r,l,a,c,u,d,p,f,h,m,$,g,b,y,w,_=t[1].i18n.newRule+"",x=(Ee(t[0])?t[1].i18n.closeAll:t[1].i18n.expandAll)+"",k=[],E=new Map,L=t[4].length&&we(t),T=At(t[0]);const z=t=>t[26];for(let e=0;e<T.length;e+=1){let n=ye(t,T,e),o=z(n);E.set(o,k[e]=_e(o,n))}let A=!t[7]&&xe();return{c(){e=R("div"),n=R("div"),o=R("div"),i=R("button"),s=q(_),r=F(),l=R("span"),c=F(),u=R("div"),L&&L.c(),d=F(),p=R("button"),f=q(x),m=F(),$=R("div");for(let t=0;t<k.length;t+=1)k[t].c();g=F(),A&&A.c(),X(i,"type","button"),X(i,"class","button add-button"),X(l,"class","woocommerce-help-tip"),X(l,"title",a=t[1].i18n.newRuleTip),X(o,"class","toolbar-left"),X(p,"type","button"),X(p,"class",h="button toggle-button "+(Ee(t[0])?"collapse":"expand")),X(u,"class","toolbar-right"),X(n,"class","main-toolbar"),X($,"class","match-rules-list"),X(e,"class","mewz-wcas-attribute-rules"),Q(e,"dragging",t[6]),Q(e,"released",t[6]&&t[6].released)},m(a,h){N(a,e,h),S(e,n),S(n,o),S(o,i),S(i,s),S(o,r),S(o,l),S(n,c),S(n,u),L&&L.m(u,null),S(u,d),S(u,p),S(p,f),S(e,m),S(e,$);for(let t=0;t<k.length;t+=1)k[t]&&k[t].m($,null);t[18]($),S(e,g),A&&A.m(e,null),t[19](e),b=!0,y||(w=[Y(i,"click",t[13]),Y(p,"click",t[12])],y=!0)},p(t,[n]){(!b||2&n)&&_!==(_=t[1].i18n.newRule+"")&&D(s,_),(!b||2&n&&a!==(a=t[1].i18n.newRuleTip))&&X(l,"title",a),t[4].length?L?L.p(t,n):(L=we(t),L.c(),L.m(u,d)):L&&(L.d(1),L=null),(!b||3&n)&&x!==(x=(Ee(t[0])?t[1].i18n.closeAll:t[1].i18n.expandAll)+"")&&D(f,x),(!b||1&n&&h!==(h="button toggle-button "+(Ee(t[0])?"collapse":"expand")))&&X(p,"class",h),1633&n&&(T=At(t[0]),xt(),k=Ct(k,n,z,1,t,T,E,$,Ot,_e,null,ye),kt()),t[7]?A&&(A.d(1),A=null):A||(A=xe(),A.c(),A.m(e,null)),(!b||64&n)&&Q(e,"dragging",t[6]),(!b||64&n)&&Q(e,"released",t[6]&&t[6].released)},i(t){if(!b){for(let t=0;t<T.length;t+=1)Et(k[t]);b=!0}},o(t){for(let t=0;t<k.length;t+=1)Lt(k[t]);b=!1},d(n){n&&P(e),L&&L.d();for(let t=0;t<k.length;t+=1)k[t].d();t[18](null),A&&A.d(),t[19](null),y=!1,v(w)}}}function Ee(t){return t.every((t=>t.open))}function Le(t){for(const e of t.attributes)if(e[0])return!0;return!1}function Te(t,e,i){const s=e.data;let r,l;it("data",s);let a=[],c=[],u=!1,d=!1,p=!1;const f=s.rules;if(f.length){if(1===f.length)f[0].open=!0;else for(let t of f)t.open=!1;a=f}else m();const h=[];for(let t in s.attributes){const e=s.attributes[t];h.push([+t,e.label])}function m(){const t={attributes:[],multiplier:"",open:!0};return a.push(t),i(0,a),t}return s.attributeOptions=h.sort(((t,e)=>t[1].localeCompare(e[1]))),nt((()=>{n(".mewz-wcas-attribute-rules .main-toolbar .woocommerce-help-tip"),o(r,s.name+"[",(t=>i(7,p=t))),i(5,u=!0)})),t.$$set=t=>{i(25,e=$($({},e),x(t)))},t.$$.update=()=>{1&t.$$.dirty&&mewzWcas.setTabIndicator("attributes",a.filter(Le).length)},e=x(e),[a,s,r,l,c,u,d,p,m,function(t){const[e,n]=t.detail;i(6,d=n)},function(t){const[e,n,o]=t.detail;"duplicate"===e?function(t){const e=JSON.parse(JSON.stringify(a[t]));e.open=!0,a.splice(t+1,0,e),i(0,a)}(n):"remove"===e?function(t){const e=a.splice(t,1)[0];e&&(Le(e)&&(e.lastIndex=t,c.push(e),i(4,c)),a.length?i(0,a):m())}(n):"shift"===e&&function(t,e){const n=a.splice(t,1)[0];a.splice(e,0,n),i(0,a)}(n,o)},function(){const t=c.pop();t&&(1!==a.length||Le(a[0])?a.splice(t.lastIndex,0,t):i(0,a[0]=t,a),delete t.lastIndex,i(4,c),i(0,a))},function(){const t=Ee(a);a.forEach((e=>e.open=!t)),i(0,a)},()=>m(),function(t){u=t,i(5,u)},function(e,n){t.$$.not_equal(n.attributes,e)&&(n.attributes=e,i(0,a))},function(e,n){t.$$.not_equal(n.multiplier,e)&&(n.multiplier=e,i(0,a))},function(e,n){t.$$.not_equal(n.open,e)&&(n.open=e,i(0,a))},function(t){lt[t?"unshift":"push"]((()=>{l=t,i(3,l)}))},function(t){lt[t?"unshift":"push"]((()=>{r=t,i(2,r)}))}]}s("#post").on("submit",(function(){const t=s("#mewz-wcas-stock-status");t.find(".spinner").addClass("is-active"),t.find("#submit").prop("disabled",!0)})),s("#mewz_wcas_internal").on("change",r),r(),setTimeout(e),a.html&&l(a.html).insertAfter(".wrap > .page-title-action"),u=document.getElementById("post"),mewzWcas.setTabIndicator=d,p("settings"),p("filters"),new class extends qt{constructor(t){super(),Pt(this,t,ie,oe,w,{})}}({target:document.getElementById("components_panel"),props:{data:mewzWcas.components}}),new class extends qt{constructor(t){super(),Pt(this,t,Te,ke,w,{})}}({target:document.getElementById("attributes_panel"),props:{data:mewzWcas.matchRules}})})()})();
  • attribute-stock-for-woocommerce/trunk/attribute-stock-for-woocommerce.php

    r3110100 r3135163  
    44 * Plugin URI:  https://codecanyon.net/item/woocommerce-attribute-stock/25796765
    55 * Description: Take your stock to the next level. Set up complex stock configurations with ease. Shared stock, variable quantities, the possibilities are endless.
    6  * Version:     2.0.2
     6 * Version:     2.0.3
    77 * Author:      Mewz
    88 * Author URI:  https://mewz.dev/
     
    1414 * Requires Plugins: woocommerce
    1515 * WC requires at least: 6.0
    16  * WC tested up to: 9.0
     16 * WC tested up to: 9.1
    1717 */
    1818
     
    2323}
    2424
    25 const MEWZ_WCAS_VERSION = '2.0.2';
     25const MEWZ_WCAS_VERSION = '2.0.3';
    2626const MEWZ_WCAS_NAME = 'WooCommerce Attribute Stock';
    2727const MEWZ_WCAS_SLUG = 'woocommerce-attribute-stock';
  • attribute-stock-for-woocommerce/trunk/includes/functions.php

    r3108898 r3135163  
    4141
    4242/**
     43 * Retrieves the lowest matching attribute stock quantity data for a product or variation.
     44 *
     45 * This is the main method used to determine a product's available stock on the frontend
     46 * based on matching attribute stock.
     47 *
     48 * @param \WC_Product|int $product Product object or ID
     49 * @param array $variation Selected variation key/value pairs
     50 *
     51 * @return array|false
     52 */
     53function mewz_wcas_get_product_stock_limit($product, $variation = null)
     54{
     55    return Util\Limits::get_stock_limit($product, $variation);
     56}
     57
     58/**
    4359 * Retrieves a list of matching attribute stock quantity data for a product or variation,
    4460 * sorted from lowest to highest stock.
     
    5268{
    5369    return Util\Limits::get_stock_limits($product, $variation);
    54 }
    55 
    56 /**
    57  * Retrieves the lowest matching attribute stock quantity data for a product or variation.
    58  *
    59  * This is the main method used to determine a product's available stock on the frontend
    60  * based on matching attribute stock.
    61  *
    62  * @param \WC_Product|int $product Product object or ID
    63  * @param array $variation Selected variation key/value pairs
    64  *
    65  * @return array|false
    66  */
    67 function mewz_wcas_get_product_stock_limit($product, $variation = null)
    68 {
    69     return Util\Limits::get_stock_limit($product, $variation);
    7070}
    7171
     
    9999{
    100100    return Util\Matches::match_raw_stock($attributes);
     101}
     102
     103/**
     104 * Set variation attributes on a product object. This is required to match the correct attribute
     105 * stock when working with "any" product variations for example, where the attributes aren't
     106 * explicitly specified on the variation.
     107 *
     108 * @param \WC_Product $product
     109 * @param array<string, string>|null $variation Variation attributes
     110 */
     111function mewz_wcas_set_product_variation(\WC_Product $product, $variation)
     112{
     113    Util\Products::set_variation($product, $variation);
    101114}
    102115
  • attribute-stock-for-woocommerce/trunk/languages/woocommerce-attribute-stock.pot

    r3110100 r3135163  
    33msgid ""
    44msgstr ""
    5 "Project-Id-Version: WooCommerce Attribute Stock 2.0.2\n"
     5"Project-Id-Version: WooCommerce Attribute Stock 2.0.3\n"
    66"Report-Msgid-Bugs-To: https://wordpress.org/support/plugin/woocommerce-attribute-stock\n"
    77"Last-Translator: FULL NAME <EMAIL@ADDRESS>\n"
     
    1010"Content-Type: text/plain; charset=UTF-8\n"
    1111"Content-Transfer-Encoding: 8bit\n"
    12 "POT-Creation-Date: 2024-06-30T23:28:11+02:00\n"
     12"POT-Creation-Date: 2024-08-13T23:48:50+02:00\n"
    1313"PO-Revision-Date: YEAR-MO-DA HO:MI+ZONE\n"
    1414"X-Generator: WP-CLI 2.10.0\n"
     
    461461
    462462#: src/Aspects/Admin/Stock/StockList.php:281
    463 #: templates/admin/stock/panel-settings.php:28
     463#: templates/admin/stock/panel-settings.php:35
    464464msgid "Internal stock"
    465465msgstr ""
    466466
    467467#: src/Aspects/Admin/Stock/StockList.php:282
    468 #: templates/admin/stock/panel-settings.php:39
     468#: templates/admin/stock/panel-settings.php:46
    469469msgid "Multiplex matching"
    470470msgstr ""
    471471
    472472#: src/Aspects/Admin/Stock/StockList.php:283
    473 #: templates/admin/stock/panel-settings.php:48
     473#: templates/admin/stock/panel-settings.php:55
    474474msgid "Lock multipliers"
    475475msgstr ""
     
    572572msgstr ""
    573573
    574 #: src/Util/Export.php:41
     574#: src/Util/Export.php:42
    575575msgid "Request headers have already been sent. This usually happens when PHP warnings or notices are being displayed. Please fix these and try again."
    576576msgstr ""
    577577
    578 #: src/Util/Export.php:47
     578#: src/Util/Export.php:48
    579579msgid "Writing to PHP's output stream (php://output) has been disabled. Unable to output CSV file download."
    580580msgstr ""
    581581
    582 #: src/Util/Orders.php:453
     582#: src/Util/Orders.php:467
    583583msgctxt "order note line format"
    584584msgid "%1$s: %2$s&rarr;%3$s"
     
    612612#: templates/admin/attributes/add-fields.php:52
    613613#: templates/admin/attributes/edit-fields.php:157
    614 msgid "The default stock multiplier to use for product stock and attribute stock."
     614msgid "The default stock multiplier to use for product stock or attribute stock."
    615615msgstr ""
    616616
     
    625625#: templates/admin/products/product-fields.php:12
    626626#: templates/admin/products/variation-fields.php:13
    627 msgid "Set a multiplier for stock quantities. Applies to product stock if managing stock, otherwise applies to attribute stock (overrides multipliers on attribute stock items). Multipliers set on variations take priority."
     627msgid "Set a multiplier for stock quantities. Applies to product stock if managing stock, otherwise applies to attribute stock (inherit multipliers on attribute stock items). Multipliers set on variations take priority."
    628628msgstr ""
    629629
     
    726726msgstr ""
    727727
    728 #: templates/admin/stock/panel-settings.php:21
     728#: templates/admin/stock/panel-settings.php:24
    729729msgid "When stock reaches this amount or less, you will be notified by email (if enabled)."
    730730msgstr ""
    731731
    732 #: templates/admin/stock/panel-settings.php:31
     732#: templates/admin/stock/panel-settings.php:38
    733733msgid "Internal stock is ignored when determining the stock availability of matched products"
    734734msgstr ""
    735735
    736 #: templates/admin/stock/panel-settings.php:42
    737 msgid "Deduct stock for multiple matching rules simultaneously instead of only the first matched rule"
    738 msgstr ""
    739 
    740 #: templates/admin/stock/panel-settings.php:51
     736#: templates/admin/stock/panel-settings.php:49
     737msgid "Deduct stock for multiple matching rules simultaneously (instead of only the first matched rule)"
     738msgstr ""
     739
     740#: templates/admin/stock/panel-settings.php:58
    741741msgid "Prevent this item's stock multipliers from being overridden by products"
    742742msgstr ""
    743743
    744 #: templates/admin/stock/panel-settings.php:57
     744#: templates/admin/stock/panel-settings.php:68
     745msgid "Product SKU"
     746msgstr ""
     747
     748#: templates/admin/stock/panel-settings.php:71
     749msgid "Allow matched products to inherit this stock item's SKU"
     750msgstr ""
     751
     752#: templates/admin/stock/panel-settings.php:79
    745753msgid "Product image"
    746754msgstr ""
    747755
    748 #: templates/admin/stock/panel-settings.php:60
    749 msgid "Use this item's stock image as a fallback for matched products with no image"
    750 msgstr ""
     756#: templates/admin/stock/panel-settings.php:82
     757msgid "Allow matched products to inherit this stock item's image"
     758msgstr ""
  • attribute-stock-for-woocommerce/trunk/readme.txt

    r3110102 r3135163  
    33Tags: attribute stock, shared stock, variable stock, woocommerce, stock
    44Requires at least: 5.4
    5 Tested up to: 6.5
     5Tested up to: 6.6
    66Requires PHP: 7.4
    7 Stable tag: 2.0.2
     7Stable tag: 2.0.3
    88License: GPLv3
    99License URI: https://www.gnu.org/licenses/gpl-3.0.html
     
    109109== Changelog ==
    110110
     111= 2.0.3 (2024-08-13) =
     112- WordPress 6.6 compatibility.
     113- WooCommerce 9.1 compatibility.
     114- Added product SKU inheriting from stock items.
     115- Added a filter for stock item default values.
     116- Fixed inherited product data not showing on order items.
     117- Fixed webhooks relying on the WC legacy API.
     118- Fixed product stock actions not firing properly for variable quantity products.
     119- Optimized background tasks to be less aggressive with server resources.
     120
    111121= 2.0.2 (2024-06-30) =
    112122- Fixed a bug with product stock multiplier checking when adding to cart in certain cases.
  • attribute-stock-for-woocommerce/trunk/src/Aspects/Admin/Stock/StockSave.php

    r3106385 r3135163  
    5555
    5656            if (!$data['internal']) {
     57                $data['product_sku'] = !empty($data['product_sku']);
    5758                $data['product_image'] = !empty($data['product_image']);
    5859            }
  • attribute-stock-for-woocommerce/trunk/src/Aspects/Common/Webhooks.php

    r3106385 r3135163  
    6767
    6868        if ($resource === AttributeStock::POST_TYPE && $resource_id && !$payload) {
    69             $payload = WC()->api->get_endpoint_data("/wc/v3/attribute-stock/{$resource_id}");
     69            $request = new \WP_REST_Request('GET', "/wc/v3/attribute-stock/{$resource_id}");
     70            $response = rest_do_request($request);
     71            $server = rest_get_server();
     72            $payload = wp_json_encode($server->response_to_data($response, false));
     73            $payload = json_decode($payload, true);
    7074        }
    7175
  • attribute-stock-for-woocommerce/trunk/src/Classes/RestApiController.php

    r3108898 r3135163  
    134134                ],
    135135                'lock_multipliers' => [
     136                    'type' => 'boolean',
     137                    'context' => ['view', 'edit'],
     138                ],
     139                'product_sku' => [
    136140                    'type' => 'boolean',
    137141                    'context' => ['view', 'edit'],
  • attribute-stock-for-woocommerce/trunk/src/Core/Loader.php

    r3106385 r3135163  
    145145
    146146        add_image_size('32x32', 32, 32, true);
     147
     148        AttributeStock::apply_defaults();
    147149    }
    148150
  • attribute-stock-for-woocommerce/trunk/src/Models/AttributeStock.php

    r3106385 r3135163  
    1212    const MODEL_TYPE = self::POST_TYPE;
    1313
    14     protected static $alias_props = [
    15         'image_id' => 'thumbnail_id',
    16         'notes' => 'content',
    17     ];
    18 
    19     protected $data = [
     14    protected static $props = [
    2015        'thumbnail_id' => null,
    2116        'sku' => '',
     
    2520        'multiplex' => false,
    2621        'lock_multipliers' => false,
     22        'product_sku' => false,
    2723        'product_image' => false,
    2824        'products' => [],
     
    3329    ];
    3430
     31    protected static $alias_props = [
     32        'image_id' => 'thumbnail_id',
     33        'notes' => 'content',
     34    ];
     35
    3536    /**
    3637     * @return bool
     
    207208     * @return bool
    208209     */
     210    public function product_sku()
     211    {
     212        return (bool)$this->get('product_sku');
     213    }
     214
     215    /**
     216     * @param bool $value
     217     */
     218    public function set_product_sku($value)
     219    {
     220        $this->set('product_sku', (bool)$value);
     221    }
     222
     223    /**
     224     * @return bool
     225     */
    209226    public function product_image()
    210227    {
  • attribute-stock-for-woocommerce/trunk/src/Util/Export.php

    r3106385 r3135163  
    1717        'multiplex' => '',
    1818        'lock_multipliers' => '',
     19        'product_sku' => '',
    1920        'product_image' => '',
    2021        'image_id' => '',
     
    337338        }
    338339
    339         foreach (['enabled', 'internal', 'multiplex', 'lock_multipliers', 'product_image'] as $key) {
     340        $bool_keys = [
     341            'enabled',
     342            'internal',
     343            'multiplex',
     344            'lock_multipliers',
     345            'product_sku',
     346            'product_image',
     347        ];
     348
     349        foreach ($bool_keys as $key) {
    340350            if (isset($data[$key])) {
    341351                $data[$key] = wc_string_to_bool($data[$key]);
  • attribute-stock-for-woocommerce/trunk/src/Util/Matches.php

    r3106385 r3135163  
    12031203     * @return array|false
    12041204     */
    1205     public static function get_any_match_data($products, $attributes, $parent = null)
     1205    public static function get_any_match_data($products, $attributes, $parent)
    12061206    {
    12071207        if (!$attributes) return false;
     
    12501250        }
    12511251
    1252         if ($parent && Products::is_product_excluded($parent)) {
     1252        if (Products::is_product_excluded($parent)) {
    12531253            return $match_data;
    12541254        }
     
    12571257
    12581258        foreach ($products as $product) {
    1259             if (!Products::is_product_excluded($product, $parent ? false : null)) {
     1259            if (!Products::is_product_excluded($product, false)) {
    12601260                $valid_products[] = $product;
    12611261            }
     
    12961296        $max_quantity = 0;
    12971297
     1298        $inherit_sku = apply_filters('mewz_wcas_inherit_product_sku', true, $parent);
     1299        $inherit_image = apply_filters('mewz_wcas_inherit_product_image', true, $parent);
     1300
    12981301        if (count($rule_data) >= 3) {
    12991302            $stock_ids = array_keys(array_column($rule_data, null, 'stock_id'));
     
    13501353                }
    13511354
    1352                 if ($stock->product_image() && $image_id = $stock->image_id()) {
     1355                if ($inherit_sku && $stock->product_sku() && ($sku = $stock->sku()) !== '') {
     1356                    $match['s'] = $sku;
     1357                }
     1358
     1359                if ($inherit_image && $stock->product_image() && $image_id = $stock->image_id()) {
    13531360                    $match['g'] = $image_id;
    13541361                }
     
    13771384        }
    13781385
    1379         $matches = apply_filters('mewz_wcas_any_match_data_matches', $matches, $match_data + compact('products', 'attributes', 'max_quantity'));
     1386        $matches = apply_filters('mewz_wcas_any_match_data_matches', $matches, $match_data + compact('products', 'parent', 'attributes', 'max_quantity'));
    13801387
    13811388        if ($matches) {
  • attribute-stock-for-woocommerce/trunk/src/Util/Orders.php

    r3106385 r3135163  
    327327     * @param \WC_Product $product
    328328     *
    329      * @return array|false
     329     * @return array
    330330     */
    331331    public static function get_order_item_attributes($order_item, $product = null)
     
    337337
    338338        // merge order item attributes
     339        $attributes = array_merge($attributes, self::get_order_item_meta_attributes($order_item));
     340
     341        return apply_filters('mewz_wcas_order_item_attributes', $attributes, $order_item, $product);
     342    }
     343
     344    /**
     345     * @param \WC_Order_Item_Product $order_item
     346     *
     347     * @return array
     348     */
     349    public static function get_order_item_meta_attributes($order_item)
     350    {
     351        $attributes = [];
     352
    339353        foreach ($order_item->get_meta_data() as $meta) {
    340354            if (strpos($key = $meta->key, 'pa_') === 0) {
     
    343357        }
    344358
    345         return apply_filters('mewz_wcas_order_item_attributes', $attributes, $order_item, $product);
     359        return apply_filters('mewz_wcas_order_item_meta_attributes', $attributes, $order_item);
    346360    }
    347361
  • attribute-stock-for-woocommerce/trunk/src/Util/Products.php

    r3108898 r3135163  
    499499
    500500    /**
     501     * @param \WC_Product $product
     502     * @param string $method
     503     *
     504     * @return mixed
     505     */
     506    public static function without_limits($product, $method)
     507    {
     508        self::incr_prop($product, 'bypass_limits');
     509        $value = $product->$method();
     510        self::decr_prop($product, 'bypass_limits');
     511        return $value;
     512    }
     513
     514    /**
     515     * @param \WC_Product $product
     516     * @param array<string, string>|null $variation
     517     */
     518    public static function set_variation($product, $variation)
     519    {
     520        $current = self::get_prop($product, 'variation');
     521
     522        if ($current !== $variation) {
     523            self::set_prop($product, 'variation', $variation);
     524
     525            // clear stock limit prop cache whenever variation prop changes
     526            if (self::has_prop($product, 'stock_limit')) {
     527                self::set_prop($product, 'stock_limit', null);
     528            }
     529        }
     530    }
     531
     532    /**
    501533     * @param object $product
    502534     * @param string $key
     
    592624        return self::incr_prop($product, $key, -$amount);
    593625    }
    594 
    595     /**
    596      * @param \WC_Product $product
    597      * @param string $method
    598      *
    599      * @return mixed
    600      */
    601     public static function without_limits($product, $method)
    602     {
    603         self::incr_prop($product, 'bypass_limits');
    604         $value = $product->$method();
    605         self::decr_prop($product, 'bypass_limits');
    606         return $value;
    607     }
    608626}
    609627
  • attribute-stock-for-woocommerce/trunk/templates/admin/attributes/add-fields.php

    r3106385 r3135163  
    5050        <input name="mewz_wcas[multiplier]" id="mewz_wcas_multiplier" type="number" value="" step="any" placeholder="<?= esc_attr(number_format_i18n(1, 2)) ?>">
    5151        <p class="description">
    52             <?= esc_html__('The default stock multiplier to use for product stock and attribute stock.', 'woocommerce-attribute-stock') ?>
     52            <?= esc_html__('The default stock multiplier to use for product stock or attribute stock.', 'woocommerce-attribute-stock') ?>
    5353        </p>
    5454    </div>
  • attribute-stock-for-woocommerce/trunk/templates/admin/attributes/edit-fields.php

    r3106385 r3135163  
    155155
    156156            <p class="description">
    157                 <?= esc_html__('The default stock multiplier to use for product stock and attribute stock.', 'woocommerce-attribute-stock') ?>
     157                <?= esc_html__('The default stock multiplier to use for product stock or attribute stock.', 'woocommerce-attribute-stock') ?>
    158158            </p>
    159159        </td>
  • attribute-stock-for-woocommerce/trunk/templates/admin/products/product-fields.php

    r3106385 r3135163  
    1010$lang = str_replace('_', '-', get_bloginfo('language'));
    1111
    12 $multiplier_desc = __('Set a multiplier for stock quantities. Applies to product stock if managing stock, otherwise applies to attribute stock (overrides multipliers on attribute stock items). Multipliers set on variations take priority.', 'woocommerce-attribute-stock');
     12$multiplier_desc = __('Set a multiplier for stock quantities. Applies to product stock if managing stock, otherwise applies to attribute stock (inherit multipliers on attribute stock items). Multipliers set on variations take priority.', 'woocommerce-attribute-stock');
    1313
    1414if (MEWZ_WCAS_LITE) {
  • attribute-stock-for-woocommerce/trunk/templates/admin/products/variation-fields.php

    r3106385 r3135163  
    1111$lang = str_replace('_', '-', get_bloginfo('language'));
    1212
    13 $multiplier_desc = __('Set a multiplier for stock quantities. Applies to product stock if managing stock, otherwise applies to attribute stock (overrides multipliers on attribute stock items). Multipliers set on variations take priority.', 'woocommerce-attribute-stock');
     13$multiplier_desc = __('Set a multiplier for stock quantities. Applies to product stock if managing stock, otherwise applies to attribute stock (inherit multipliers on attribute stock items). Multipliers set on variations take priority.', 'woocommerce-attribute-stock');
    1414
    1515if (MEWZ_WCAS_LITE) {
  • attribute-stock-for-woocommerce/trunk/templates/admin/stock/panel-settings.php

    r3106385 r3135163  
    1212
    1313$pro_cta = MEWZ_WCAS_LITE ? '<a href="' . esc_url($this->plugin->sale_url()) . '" class="mewz-wcas-pro-cta" title="' . esc_attr__('Full version required — Click to upgrade', 'woocommerce-attribute-stock') . '" target="_blank">PRO</a>' : '';
     14?>
    1415
    15 woocommerce_wp_text_input([
     16<div class="options_group">
     17    <?php
     18    woocommerce_wp_text_input([
    1619    'label' => __('Low stock threshold', 'woocommerce'),
    1720    'id' => 'mewz_wcas_low_stock',
     
    2326    'value' => Number::safe_decimal($stock->low_stock()),
    2427    'custom_attributes' => ['step' => 'any', 'lang' => $lang],
    25 ]);
     28    ]);
     29    ?>
     30</div>
    2631
    27 woocommerce_wp_checkbox([
    28     'label' => __('Internal stock', 'woocommerce-attribute-stock') . $pro_cta,
    29     'id' => 'mewz_wcas_internal',
    30     'name' => 'mewz_wcas[internal]',
    31     'description' => __('Internal stock is ignored when determining the stock availability of matched products', 'woocommerce-attribute-stock'),
    32     'cbvalue' => 1,
    33     'value' => MEWZ_WCAS_LITE ? 1 : (int)$stock->internal(),
    34     'custom_attributes' => MEWZ_WCAS_LITE ? ['disabled' => 'disabled'] : [],
    35     'wrapper_class' => MEWZ_WCAS_LITE ? 'mewz-wcas-pro-required' : '',
    36 ]);
     32<div class="options_group">
     33    <?php
     34    woocommerce_wp_checkbox([
     35        'label' => __('Internal stock', 'woocommerce-attribute-stock') . $pro_cta,
     36        'id' => 'mewz_wcas_internal',
     37        'name' => 'mewz_wcas[internal]',
     38        'description' => __('Internal stock is ignored when determining the stock availability of matched products', 'woocommerce-attribute-stock'),
     39        'cbvalue' => 1,
     40        'value' => MEWZ_WCAS_LITE ? 1 : (int)$stock->internal(),
     41        'custom_attributes' => MEWZ_WCAS_LITE ? ['disabled' => 'disabled'] : [],
     42        'wrapper_class' => MEWZ_WCAS_LITE ? 'mewz-wcas-pro-required' : '',
     43    ]);
    3744
    38 woocommerce_wp_checkbox([
    39     'label' => __('Multiplex matching', 'woocommerce-attribute-stock'),
    40     'id' => 'mewz_wcas_multiplex',
    41     'name' => 'mewz_wcas[multiplex]',
    42     'description' => __('Deduct stock for multiple matching rules simultaneously instead of only the first matched rule', 'woocommerce-attribute-stock'),
    43     'cbvalue' => 1,
    44     'value' => (int)$stock->multiplex(),
    45 ]);
     45    woocommerce_wp_checkbox([
     46        'label' => __('Multiplex matching', 'woocommerce-attribute-stock'),
     47        'id' => 'mewz_wcas_multiplex',
     48        'name' => 'mewz_wcas[multiplex]',
     49        'description' => __('Deduct stock for multiple matching rules simultaneously (instead of only the first matched rule)', 'woocommerce-attribute-stock'),
     50        'cbvalue' => 1,
     51        'value' => (int)$stock->multiplex(),
     52    ]);
    4653
    47 woocommerce_wp_checkbox([
    48     'label' => __('Lock multipliers', 'woocommerce-attribute-stock'),
    49     'id' => 'mewz_wcas_lock_multipliers',
    50     'name' => 'mewz_wcas[lock_multipliers]',
    51     'description' => __('Prevent this item\'s stock multipliers from being overridden by products', 'woocommerce-attribute-stock'),
    52     'cbvalue' => 1,
    53     'value' => (int)$stock->lock_multipliers(),
    54 ]);
     54    woocommerce_wp_checkbox([
     55        'label' => __('Lock multipliers', 'woocommerce-attribute-stock'),
     56        'id' => 'mewz_wcas_lock_multipliers',
     57        'name' => 'mewz_wcas[lock_multipliers]',
     58        'description' => __('Prevent this item\'s stock multipliers from being overridden by products', 'woocommerce-attribute-stock'),
     59        'cbvalue' => 1,
     60        'value' => (int)$stock->lock_multipliers(),
     61    ]);
     62    ?>
     63</div>
    5564
    56 woocommerce_wp_checkbox([
    57     'label' => __('Product image', 'woocommerce-attribute-stock') . $pro_cta,
    58     'id' => 'mewz_wcas_product_image',
    59     'name' => 'mewz_wcas[product_image]',
    60     'description' => __('Use this item\'s stock image as a fallback for matched products with no image', 'woocommerce-attribute-stock'),
    61     'cbvalue' => 1,
    62     'value' => (int)$stock->product_image(),
    63     'custom_attributes' => MEWZ_WCAS_LITE ? ['disabled' => 'disabled'] : [],
    64     'wrapper_class' => MEWZ_WCAS_LITE ? 'mewz-wcas-pro-required' : '',
    65 ]);
     65<div class="options_group">
     66    <?php
     67    woocommerce_wp_checkbox([
     68        'label' => __('Product SKU', 'woocommerce-attribute-stock') . $pro_cta,
     69        'id' => 'mewz_wcas_product_sku',
     70        'name' => 'mewz_wcas[product_sku]',
     71        'description' => __('Allow matched products to inherit this stock item\'s SKU', 'woocommerce-attribute-stock'),
     72        'cbvalue' => 1,
     73        'value' => (int)$stock->product_sku(),
     74        'custom_attributes' => MEWZ_WCAS_LITE ? ['disabled' => 'disabled'] : [],
     75        'wrapper_class' => MEWZ_WCAS_LITE ? 'mewz-wcas-pro-required' : '',
     76    ]);
     77
     78    woocommerce_wp_checkbox([
     79        'label' => __('Product image', 'woocommerce-attribute-stock') . $pro_cta,
     80        'id' => 'mewz_wcas_product_image',
     81        'name' => 'mewz_wcas[product_image]',
     82        'description' => __('Allow matched products to inherit this stock item\'s image', 'woocommerce-attribute-stock'),
     83        'cbvalue' => 1,
     84        'value' => (int)$stock->product_image(),
     85        'custom_attributes' => MEWZ_WCAS_LITE ? ['disabled' => 'disabled'] : [],
     86        'wrapper_class' => MEWZ_WCAS_LITE ? 'mewz-wcas-pro-required' : '',
     87    ]);
     88    ?>
     89</div>
  • attribute-stock-for-woocommerce/trunk/vendor/composer/installed.php

    r3110100 r3135163  
    44        'pretty_version' => 'dev-master',
    55        'version' => 'dev-master',
    6         'reference' => '2a9d568c24abae2e6b0f664d27a34745ad79b152',
     6        'reference' => 'e1823a99e74b6923d0d463c04101ad94ae7b4a84',
    77        'type' => 'wordpress-plugin',
    88        'install_path' => __DIR__ . '/../../',
     
    3232            'pretty_version' => 'dev-master',
    3333            'version' => 'dev-master',
    34             'reference' => '2a9d568c24abae2e6b0f664d27a34745ad79b152',
     34            'reference' => 'e1823a99e74b6923d0d463c04101ad94ae7b4a84',
    3535            'type' => 'wordpress-plugin',
    3636            'install_path' => __DIR__ . '/../../',
  • attribute-stock-for-woocommerce/trunk/vendor/mewz/framework/languages/mewz-framework.pot

    r3110100 r3135163  
    88"Content-Type: text/plain; charset=UTF-8\n"
    99"Content-Transfer-Encoding: 8bit\n"
    10 "POT-Creation-Date: 2024-06-30T23:28:12+02:00\n"
     10"POT-Creation-Date: 2024-08-13T23:48:50+02:00\n"
    1111"PO-Revision-Date: YEAR-MO-DA HO:MI+ZONE\n"
    1212"X-Generator: WP-CLI 2.10.0\n"
  • attribute-stock-for-woocommerce/trunk/vendor/mewz/framework/src/Base/Model.php

    r3106385 r3135163  
    3131    protected static $instance = [];
    3232
     33    /** @var array Object data properties */
     34    protected static $props = [];
     35
    3336    /** @var array Alias object property mappings */
    3437    protected static $alias_props = [];
     
    9497    }
    9598
     99    public static function apply_defaults()
     100    {
     101        $defaults = apply_filters(static::hook_name('defaults'), []);
     102        if (!$defaults) return;
     103
     104        static::$props = array_merge(static::$props, array_intersect_key($defaults, static::$props));
     105    }
     106
    96107    protected function set_valid_props()
    97108    {
     109        $this->data = static::$props;
     110
    98111        foreach ($this->data as $prop => $value) {
    99112            $this->valid_props[$prop] = $prop;
  • attribute-stock-for-woocommerce/trunk/vendor/mewz/framework/src/Services/Tasks.php

    r3106385 r3135163  
    8787        $task = $params['task'];
    8888
    89         $result = $this->verify_nonce($task, $params['_nonce']);
    90 
    91         if (!$result) {
     89        if (!$this->verify_nonce($task, $params['_nonce'])) {
    9290            return $this->kill(403);
    9391        }
     
    107105    }
    108106
    109     public function near_limits()
     107    public function near_limits($throttle = 0.1)
    110108    {
    111109        $time_limit = self::get_current_limit('time');
     
    119117        if ($memory_limit && memory_get_usage(true) >= $memory_limit * .8) {
    120118            return true;
     119        }
     120
     121        // wait a bit before moving on to prevent hogging the cpu
     122        if ($throttle) {
     123            usleep($throttle * 1000000);
    121124        }
    122125
     
    167170        $this->current_request_ended = true;
    168171
    169         // attempt to not lock up other requests while processing
     172        // attempt to set the process to low cpu priority
     173        if (function_exists('proc_nice')) {
     174            @proc_nice(20);
     175        }
     176
     177        // attempt to not lock up other request sessions while processing
    170178        if (function_exists('session_write_close')) {
    171179            session_write_close();
Note: See TracChangeset for help on using the changeset viewer.