(()=>{var i,e;window.shiptastic=window.shiptastic||{},window.shiptastic.admin=window.shiptastic.admin||{},i=jQuery,(e=window.shiptastic).admin.shipment_label={params:{},init:function(){var t=e.admin.shipment_label;i(document).on("change",".shipments-create-label #product_id",t.onChangeLabelProductId)},onChangeLabelProductId:function(){e.admin.shipment_label.showOrHideByLabelProduct(i(this).val())},showOrHideByLabelProduct:function(e){i(".shipments-create-label").find("p.form-field :input[data-products-supported]").each((function(){var t=i(this),n=t.data("products-supported");if(n.length>0)if(n.indexOf("&")>-1&&t.is("select")){var a=n.split("&").filter(Boolean),s=!1;i.each(a,(function(n,a){var r=a.split("=").filter(Boolean);if(r.length>1){var o=r[0],d=r[1].split(","),c=!0,l=t.find('option[value="'+o+'"]');l.length>0&&(-1!==i.inArray(e,d)&&(c=!1),c?(l.is(":selected")&&(s=!0),l.hide()):l.show())}}));var r=!0;t.find("option").each((function(){if("none"!==i(this).css("display"))return s&&i(this).prop("selected",!0),r=!1,!1})),r?(t.parents(".form-field").hide(),t.trigger("change")):(t.parents(".form-field").show(),t.trigger("change")),t.trigger("change")}else{var o=n.split(",").filter(Boolean),d=o.length>0;-1!==i.inArray(e,o)&&(d=!1),d?(t.parents(".form-field").hide(),t.trigger("change")):(t.parents(".form-field").show(),t.trigger("change"))}}))}},i(document).ready((function(){e.admin.shipment_label.init()})),((window.wcShiptastic=window.wcShiptastic||{}).static=window.wcShiptastic.static||{})["admin-shipment-label"]={}})();