Symbol();
const BUTTON_STYLE = `
input[type="button"], input[type="submit"] {
padding: 12px 16px;
cursor: pointer;
border: none;
border-width: 1px;
border-radius: 5px;
font-size: 14px;
font-weight: 400;
box-shadow: 0 10px 20px -6px rgba(0,0,0,.12);
position: relative;
margin-bottom: 20px;
transition: .3s;
background: #46b5d1;
color: #fff;
display: inline-block;
font-weight: 400;
text-align: center;
vertical-align: middle;
user-select: none;
padding: .375rem .75rem;
font-size: 1rem;
line-height: 1.5;
transition: color .15s ease-in-out,
background-color .15s ease-in-out,
border-color .15s ease-in-out,
box-shadow .15s ease-in-out,
width: auto;
height: calc(1.5em + 0.75rem + 2px);
padding: .375rem .75rem;
border: 1px solid #495057;
color: #495057;
background: white;
}
`;
const FORM_STYLE = `
form {
display: block;
}
form legend {
margin: 16px 0;
font-weight: bold;
font-size: 20px;
}
form.inline div {
display: flex;
}
form > div {
display: block;
margin-bottom: 1rem;
}
input, textarea {
font-size: 16px;
border: none;
border-bottom-style: none;
border-bottom-width: medium;
border-bottom: 1px solid rgba(0,0,0,.1);
border-radius: 2px;
padding: 0;
height: 36px;
background: #fff;
color: rgba(0,0,0,.8);
font-size: 14px;
box-shadow: none !important;
display: block;
width: 100%;
height: calc(1.5em + 0.75rem + 2px);
padding: .375rem .75rem;
font-size: 1rem;
font-weight: 400;
line-height: 1.5;
color: #495057;
background-clip: padding-box;
transition: border-color .15s ease-in-out , -webkit-box-shadow .15s ease-in-out;
transition: border-color .15s ease-in-out , box-shadow .15s ease-in-out;
transition: border-color .15s ease-in-out , box-shadow .15s ease-in-out , -webkit-box-shadow .15s ease-in-out;
}
input[type="text"],
input[type="number"],
input[type="email"],
input[type="password"],
textarea {
width: calc(100% - 1.5rem - 2px);
}
label {
color: #000;
text-transform: uppercase;
font-size: 12px;
font-weight: 600;
display: inline-block;
margin-bottom: .5rem;
}
${BUTTON_STYLE}
`;
class Component extends HTMLElement {
#a;
static get observedAttributes() {
return [];
}
constructor(a){
super(), this.#a = this.attachShadow({
mode: "open"
}), this.#a.innerHTML = a;
}
connectedCallback() {
let a = this.constructor.observedAttributes;
if (Array.isArray(a)) for (let b of a){
let c = this.constructor.attr2Field(b);
c && (this[c] = this[c]);
}
}
attributeChangedCallback(a, b, c) {
if (b === c) return;
let d = this.constructor.observedAttributes;
if (!Array.isArray(d) || !d.includes(a)) return;
let e = this.constructor.attr2Field(a);
e && (this[e] = c);
}
static attr2Field(a) {
if (!(this.constructor.attr2FieldBlacklist || []).includes(a)) return a.replace("-", "_");
}
static get attr2FieldBlacklist() {
return [];
}
}
class PseudoForm extends Component {
reportValidity() {
return this.shadowRoot.querySelector("form").reportValidity();
}
checkValidity() {
return this.shadowRoot.querySelector("form").checkValidity();
}
get elements() {
return this.shadowRoot.querySelector("form").elements;
}
}
const fireFbReady = ()=>{
for (let c of (b = !0, a))c();
};
const runFbReady = (c)=>{
b ? c() : a.push(c);
};
let a = [], b = !1;
customElements.define("form-navigation", class extends Component {
static get observedAttributes() {
return [
"next",
"prev"
];
}
constructor(){
super(`
`), this.shadowRoot.querySelector("#prev").addEventListener("click", (a)=>{
a.stopPropagation(), a.preventDefault(), this.prev();
}), this.shadowRoot.querySelector("#next").addEventListener("click", (a)=>{
a.stopPropagation(), a.preventDefault(), this.next();
});
}
attributeChangedCallback(a, b, c) {
if (b !== c) switch(a){
case "next":
this.shadowRoot.querySelector("#next").className = "hidden" === c ? "hidden" : "";
break;
case "prev":
this.shadowRoot.querySelector("#prev").className = "hidden" === c ? "hidden" : "";
}
}
next() {
this.dispatchEvent(new CustomEvent("form:next", {
bubbles: !0,
composed: !0,
detail: this.parentElement
}));
}
prev() {
this.dispatchEvent(new CustomEvent("form:prev", {
bubbles: !0,
composed: !0,
detail: this.parentElement
}));
}
});
customElements.define("local-business-item", class extends Component {
static get observedAttributes() {
return [
"name",
"price",
"picture-url"
];
}
constructor(){
super(`
`);
}
connectedCallback() {
super.connectedCallback();
}
attributeChangedCallback(a, b, c) {
super.attributeChangedCallback(a, b, c);
}
get price() {
let a = parseInt(this.getAttribute("price"));
return isNaN(a) ? 0 : a;
}
set price(a) {
this.setAttribute("price", a), this.shadowRoot.querySelector("#price").value = a;
}
get name() {
return this.getAttribute("name");
}
set name(a) {
this.setAttribute("name", a), this.shadowRoot.querySelector("#name").textContent = a;
}
get picture_url() {
return this.getAttribute("picture-url");
}
set picture_url(a) {
this.setAttribute("picture-url", a), a && (this.shadowRoot.querySelector("img").src = a);
}
});
customElements.define("local-business", class extends Component {
static get observedAttributes() {
return [
"name",
"service-id",
"state"
];
}
constructor(){
super(`
`);
}
connectedCallback() {
super.connectedCallback();
}
attributeChangedCallback(a, b, c) {
super.attributeChangedCallback(a, b, c);
}
get name() {
return this.getAttribute("name") || "";
}
set name(a) {
this.setAttribute("name", a), this.shadowRoot.querySelector("#name").textContent = a;
}
get state() {
return this.getAttribute("state");
}
set state(a) {
this.setAttribute("state", a);
}
get service_id() {
return this.getAttribute("service-id");
}
set service_id(a) {
this.setAttribute("service-id", a);
}
});
customElements.define("local-businesses", class extends Component {
static get observedAttributes() {
return [
"filter"
];
}
constructor(){
super(`
`);
{
let a = this.shadowRoot.querySelector("#filter"), b = null;
a.addEventListener("change", (a)=>{
a.stopPropagation(), this.filter = a.target.value;
}), a.addEventListener("keyup", (a)=>{
a.stopPropagation();
let c = a.target.value;
b && clearTimeout(b), b = setTimeout(()=>{
this.filter = c, b = null;
}, 1000 / 3);
});
}
}
connectedCallback() {
this.filter = this.getAttribute("filter");
}
attributeChangedCallback(a, b, c) {
super.attributeChangedCallback(a, b, c);
}
get filter() {
return this.getAttribute("filter");
}
set filter(a) {
if (a && "" !== a) for (let b of (this.setAttribute("filter", a), this.querySelectorAll("local-business")))b.name && (b.name.includes(a) ? b.setAttribute("local-business-visible", "visible") : b.setAttribute("local-business-visible", "invisible"));
else for (let c of (this.removeAttribute("filter"), this.querySelectorAll("local-business")))c.removeAttribute("local-business-visible");
}
});
customElements.define("login-form", class extends Component {
constructor(){
super(`
`);
}
});
customElements.define("facebook-button", class extends Component {
#a;
static get observedAttributes() {
return [
"width",
"height",
"fb-sdk"
];
}
constructor(){
super(`
Skrypty Facebook są zablokowane przez rozszerzenie przeglądarki
`), this.shadowRoot.querySelector("#fb-icon").addEventListener("click", (a)=>{
if (a.stopPropagation(), a.preventDefault(), !this.#a) return console.info("Facebook SDK is not available");
FB.login((a)=>{
"connected" === a.status && FB.api("/me?fields=id,name,email", ({ id: a , name: b , email: c })=>{
console.info({
id: a,
name: b,
email: c
}), this.dispatchEvent(new CustomEvent("facebook:account", {
bubbles: !0,
composed: !0,
detail: {
id: a,
name: b,
email: c
}
}));
});
}, {
scope: "public_profile,email",
return_scopes: !0
});
});
}
connectedCallback() {
super.connectedCallback(), runFbReady(()=>{
this.setAttribute("fb-sdk", "available"), this.dispatchEvent(new CustomEvent("facebook:available", {
bubbles: !0,
composed: !0
}));
});
}
get width() {
return this.getAttribute("width");
}
set width(a) {
this.setAttribute("width", a), this.shadowRoot.querySelector("svg").setAttribute("width", a);
}
get height() {
return this.getAttribute("width");
}
set height(a) {
this.setAttribute("height", a), this.shadowRoot.querySelector("svg").setAttribute("height", a);
}
get fb_sdk() {
return !!this.#a;
}
set fb_sdk(a) {
this.setAttribute("fb-sdk", a), this.#a = "available" === a;
}
});
customElements.define("account-view", class extends Component {
static get observedAttributes() {
return [
"facebook-id",
"id",
"name",
"email"
];
}
constructor(){
super(`
`), this.addEventListener("facebook:available", (a)=>{
a.preventDefault(), a.stopPropagation();
});
}
get name() {
return this.getAttribute("name") || "";
}
set name(a) {
this.setAttribute("name", a), this.shadowRoot.querySelector("#name").value = a;
}
get email() {
return this.getAttribute("email") || "";
}
set email(a) {
this.setAttribute("email", a), this.shadowRoot.querySelector("#email").value = a;
}
get facebook_id() {
return this.getAttribute("facebook-id");
}
set facebook_id(a) {
this.setAttribute("facebook-id", a), this.shadowRoot.querySelector("#facebook_id").value = a;
}
});
customElements.define("ow-account", class extends Component {
static get observedAttributes() {
return [
"mode",
"id",
"name",
"email",
"facebook-id"
];
}
constructor(){
super(`
`), this.shadowRoot.querySelector("#switch-login > a").addEventListener("click", (a)=>{
a.stopPropagation(), a.preventDefault(), this.mode = "login";
}), this.shadowRoot.querySelector("#switch-register > a").addEventListener("click", (a)=>{
a.stopPropagation(), a.preventDefault(), this.mode = "register";
}), this.addEventListener("facebook:account", (a)=>{
a.stopPropagation(), a.preventDefault(), this.mode = "facebook";
let { id: b , name: c , email: d } = a.details;
console.info({
id: b,
name: c,
email: d
});
});
}
connectedCallback() {
"" === this.mode && (this.mode = "login"), this.name = this.name, this.email = this.email, this.facebook_id = this.facebook_id;
}
attributeChangedCallback(a, b, c) {
super.attributeChangedCallback(a, b, c);
}
get mode() {
return this.getAttribute("mode") || "";
}
set mode(a) {
a = [
"login",
"register",
"display"
].includes(a) ? a : "login", this.setAttribute("mode", a);
}
get name() {
return this.getAttribute("name") || "";
}
set name(a) {
this.setAttribute("name", a), this.shadowRoot.querySelector("account-view").name = a;
}
get email() {
return this.getAttribute("email") || "";
}
set email(a) {
this.setAttribute("email", a), this.shadowRoot.querySelector("account-view").email = a;
}
get facebook_id() {
return this.getAttribute("facebook-id");
}
set facebook_id(a) {
this.setAttribute("facebook-id", a), this.shadowRoot.querySelector("account-view").facebook_id = a;
}
});
customElements.define("ow-nav", class extends Component {
constructor(){
super(`
`);
}
});
customElements.define("ow-path", class extends Component {
static get observedAttributes() {
return [
"selected",
"path"
];
}
constructor(){
super(`
`);
}
connectedCallback() {
this.selected = this.getAttribute("selected");
}
attributeChangedCallback(a, b, c) {
super.attributeChangedCallback(a, b, c);
}
get selected() {
return "selected" === this.getAttribute("selected");
}
set selected(a) {
"selected" === a ? this.setAttribute("selected", "selected") : this.removeAttribute("selected");
}
get path() {
return this.getAttribute("path") || "";
}
set path(a) {
if (!a || "" === a) {
this.removeAttribute("path");
return;
}
this.setAttribute("path", a), this.shadowRoot.querySelector("a").setAttribute("href", a);
}
});
customElements.define("price-view", class extends HTMLElement {
#a;
static get observedAttributes() {
return [
"value",
"currency"
];
}
constructor(){
super();
let a = this.#a = this.attachShadow({
mode: "closed"
});
a.innerHTML = `
`;
}
connectedCallback() {
this.#a.querySelector("#price").textContent = this.formatted;
}
attributeChangedCallback(a, b, c) {
b !== c && "price" === a && (this.value = c);
}
get formatted() {
let a = this.value, b = a % 100;
return `${Math.ceil(a / 100)},${b < 10 ? `0${b}` : b}${this.currency}`;
}
get value() {
let a = parseInt(this.getAttribute("value"));
return isNaN(a) ? 0 : a;
}
set value(a) {
this.setAttribute("value", a), this.#a.querySelector("#price").textContent = this.formatted;
}
get currency() {
return this.getAttribute("currency") || "PLN";
}
});
customElements.define("price-input", class extends HTMLElement {
#a;
static get observedAttributes() {
return [
"value",
"currency",
"required",
"name"
];
}
constructor(){
super();
let b = this.#a = this.attachShadow({
mode: "closed"
});
b.innerHTML = `
`;
let c = b.querySelector("#price");
c.addEventListener("change", (a)=>{
a.stopPropagation(), this.value = c.value;
});
}
connectedCallback() {
this.#a.querySelector("#currency").textContent = this.currency, this.#a.querySelector("#price").value = this.value;
}
attributeChangedCallback(a, b, c) {
if (b === c) return;
let d = this.#a.querySelector("#price");
switch(a){
case "price":
this.value = c;
break;
case "currency":
this.currency = c;
break;
case "required":
c ? d.setAttribute("required", "required") : d.removeAttribute("required");
break;
case "readonly":
c ? d.setAttribute("readonly", "readonly") : d.removeAttribute("readonly");
break;
case "name":
this.setAttribute("name", c);
}
}
get value() {
return Math.floor(100 * parseFloat(this.#a.querySelector("#price").value));
}
set value(a) {
this.setAttribute("value", a), this.#a.querySelector("#price").value = a;
}
get currency() {
return this.getAttribute("currency") || "PLN";
}
set currency(a) {
this.setAttribute("currency", a), this.#a.querySelector("#currency").textContent = this.currency;
}
reportValidity() {
return this.#a.querySelector("input").reportValidity();
}
get name() {
return this.getAttribute("name");
}
set name(a) {
this.setAttribute("name", a);
}
});
customElements.define("register-basic-form", class extends PseudoForm {
constructor(){
super(`
`);
let b = this.shadowRoot.querySelector("form");
b.addEventListener("submit", (a)=>{
a.preventDefault(), a.stopPropagation(), this.shadowRoot.querySelector("form-navigation").next();
});
}
});
let c = (b)=>`
`;
customElements.define("register-item-form-row", class extends PseudoForm {
static get observedAttributes() {
return [
"idx",
"name"
];
}
constructor(){
super(c()), this.addEventListener("item:removed", ()=>{
this.setAttribute("removed", "removed");
let a = this.parentElement;
this.remove(), a.dispatchEvent(new CustomEvent("item:removed", {
bubbles: !0,
composed: !0
}));
});
}
connectedCallback() {
this.shadowRoot.innerHTML = c(this.idx);
let a = this.shadowRoot.querySelector("image-input");
this.addEventListener("image-input:uploaded", (b)=>{
b.preventDefault(), b.stopPropagation(), this.picture_url = a.url;
}), this.shadowRoot.querySelector("form").addEventListener("submit", (a)=>{
a.preventDefault(), a.stopPropagation(), this.reportValidity();
}), this.shadowRoot.querySelector(".remove").addEventListener("click", (a)=>{
a.preventDefault(), a.stopPropagation(), this.dispatchEvent(new CustomEvent("item:removed", {
bubbles: !0,
composed: !1
}));
});
}
attributeChangedCallback(a, b, c) {
if (b !== c) switch(a){
case "idx":
return this.updateNames();
case "picture-url":
return this.picture_url = c;
}
}
get inputs() {
return [
d(this.shadowRoot.querySelector(".item-name")),
d(this.shadowRoot.querySelector(".item-price")),
];
}
updateNames() {
let a = this.getAttribute("idx");
for (let b of this.shadowRoot.querySelectorAll(".field")){
let c = b.id;
b.querySelector("input, price-input").setAttribute("name", `items[${a}][${c}]`);
}
}
get idx() {
return this.getAttribute("idx");
}
set idx(a) {
this.setAttribute("idx", a);
}
get picture_url() {
return this.getAttribute("picture-url");
}
set picture_url(a) {
this.setAttribute("picture-url", a), this.shadowRoot.querySelector("image-input").url = a, this.shadowRoot.querySelector("#picture_url").value = a;
}
reportValidity() {
return super.reportValidity() && this.shadowRoot.querySelector("price-input").reportValidity();
}
});
let d = ({ name: a , value: b })=>({
name: a,
value: b
});
let c1 = (a)=>{
let b = 0;
for (let c of a.querySelectorAll("register-item-form-row"))c.idx = b++;
return b;
};
customElements.define("register-items-form", class extends PseudoForm {
constructor(){
super(`
`), this.addEventListener("item:removed", (a)=>{
a.stopPropagation(), c1(this);
}), this.addEventListener("form:next", (a)=>{
for (let b of this.querySelectorAll("item-form-row"))b.reportValidity() || (a.stopPropagation(), a.preventDefault());
}), this.shadowRoot.querySelector("#add-item").addEventListener("click", (a)=>{
a.stopPropagation(), a.preventDefault(), this.appendChild(document.createElement("register-item-form-row")), c1(this);
});
}
get inputs() {
return [
...this.querySelectorAll("register-item-form-row")
].map((a)=>a.inputs);
}
});
customElements.define("register-business-form", class extends PseudoForm {
constructor(){
super(`
`), this.shadowRoot.querySelector("form").addEventListener("submit", (a)=>{
a.preventDefault(), a.stopPropagation(), this.shadowRoot.querySelector("form-navigation").next();
});
}
});
customElements.define("register-submit-form", class extends PseudoForm {
constructor(){
super(`
`);
}
updateField(a, b) {
this.shadowRoot.querySelector(`[id="hidden-${a}"]`).value = b, this.shadowRoot.querySelector(`[id="preview-${a}"]`).value = b;
}
setItems(a) {
let b = this.shadowRoot.querySelector("#items");
for (let c of (b.innerHTML = "", a)){
let d = b.appendChild(document.createElement("div"));
d.className = "item-view";
let [e, f] = c;
d.innerHTML = `
`;
}
}
set accountType(a) {
this.shadowRoot.querySelector("#account_type").value = a;
}
});
customElements.define("register-user-type", class extends Component {
constructor(){
super(`
`);
let a = this.shadowRoot.querySelector("#user");
a.addEventListener("click", (a)=>{
a.preventDefault(), a.stopPropagation(), this.dispatchEvent(new CustomEvent("account:type:user", {
bubbles: !0,
composed: !0
}));
});
let b = this.shadowRoot.querySelector("#local-service");
b.addEventListener("click", (a)=>{
a.preventDefault(), a.stopPropagation(), this.dispatchEvent(new CustomEvent("account:type:local-service", {
bubbles: !0,
composed: !0
}));
});
}
});
customElements.define("register-user-form", class extends Component {
static get observedAttributes() {
return [
"mode"
];
}
constructor(){
super(`
`);
let a = this.shadowRoot.querySelector("form");
this.addEventListener("facebook:account", (b)=>{
b.stopPropagation(), b.preventDefault(), this.mode = "facebook";
let { id: c , name: d , email: e } = b.detail;
a.querySelector("#email").value = e, a.querySelector("#login").value = d, a.querySelector("#password").value = crypto.randomUUID(), a.querySelector("#facebook_id").value = c, a.querySelector("#account_type").value = "User", a.submit();
}), this.shadowRoot.querySelector("#email-icon").addEventListener("click", (a)=>{
a.stopPropagation(), a.preventDefault(), this.mode = "email";
});
}
connectedCallback() {
this.mode = "";
}
attributeChangedCallback(a, b, c) {
b !== c && "mode" === a && ("email" === c || "facebook" === c || "" === c) && (this.mode = c);
}
get mode() {
return this.getAttribute("mode") || "";
}
set mode(a) {
this.setAttribute("mode", a);
}
});
customElements.define("register-form", class extends Component {
static get observedAttributes() {
return [
"step"
];
}
constructor(){
super(`
`);
let a = this.shadowRoot.querySelector("#step-4");
this.shadowRoot.addEventListener("account:type:user", (b)=>{
b.stopPropagation(), a.accountType = "User", this.step = 40;
}), this.shadowRoot.addEventListener("account:type:local-service", (b)=>{
b.stopPropagation(), a.accountType = "Business", this.step = 1;
}), this.shadowRoot.addEventListener("form:next", (b)=>{
b.stopPropagation();
let c = this.shadowRoot.querySelector(`#step-${this.step}`);
this.#a(c, a) && (this.step = this.step + 1);
}), this.shadowRoot.addEventListener("form:prev", (a)=>{
a.stopPropagation(), this.step = this.step - 1;
}), a.addEventListener("submit", (a)=>{
a.preventDefault(), a.stopPropagation();
});
}
connectedCallback() {
this.step = 0;
}
attributeChangedCallback(a, b, c) {
super.attributeChangedCallback(a, b, c);
}
get step() {
let a = parseInt(this.getAttribute("step"));
return isNaN(a) ? 1 : a;
}
set step(a) {
a < 0 || this.setAttribute("step", a);
}
#a(a, d) {
for (let e of (a.reportValidity(), a.elements))if ("" !== e.name && !e.reportValidity()) return !1;
let f = a.inputs;
if (f) d.setItems(f);
else for (let g of a.elements)"" !== g.name && d.updateField(g.name, g.value);
return !0;
}
});
customElements.define("image-input", class extends Component {
static get observedAttributes() {
return [
"width",
"height",
"account-id",
"url"
];
}
constructor(){
super(`
`), this.shadowRoot.querySelector("#save").addEventListener("click", (a)=>{
a.preventDefault(), a.stopPropagation();
let b = document.createElement("canvas");
b.width = this.width, b.height = this.height, b.getContext("2d").putImageData(g.getImageData(0, 0, this.width, this.height), 0, 0);
let c = atob(b.toDataURL("image/webp", 1.0).split(",")[1]), d = [];
for(let e = 0; e < c.length; e++)d.push(c.charCodeAt(e));
let f = new Blob([
new Uint8Array(d)
], {
type: "image/webp"
}), h = new FormData;
h.append(`${crypto.randomUUID()}.webp`, f), fetch("/upload", {
method: "POST",
body: h
}).then((a)=>a.json()).then(({ path: a })=>{
this.url = a, this.dispatchEvent(new CustomEvent("image-input:uploaded", {
bubbles: !0,
composed: !0
}));
});
});
let b = new FileReader(), c = this.shadowRoot.querySelector("#file"), d = this.shadowRoot.querySelector("#view"), e = this.shadowRoot.querySelector("img"), f = this.shadowRoot.querySelector("canvas"), g = f.getContext("2d");
e.addEventListener("load", ()=>{
let a, b;
e.width > e.height ? (a = 200, b = 200 * e.height / e.width) : (a = 200 * e.width / e.height, b = 200), this.setAttribute("width", a), this.setAttribute("height", b), e.width = a, e.height = b, g.clearRect(0, 0, 200, 200), g.drawImage(e, 0, 0, a, b);
}), c.addEventListener("change", (a)=>{
a.stopPropagation(), b.addEventListener("loadend", (a)=>{
a.total === a.loaded && (e.src = a.target.result || "");
}), b.readAsDataURL(a.target.files[0]);
}), d.addEventListener("click", (a)=>{
a.stopPropagation(), c.click();
});
}
connectedCallback() {
this.account_id = this.account_id, this.url = this.url;
}
attributeChangedCallback(a, b, c) {
super.attributeChangedCallback(a, b, c);
}
get account_id() {
return this.getAttribute("account-id");
}
set account_id(a) {
this.setAttribute("account-id", a);
}
get width() {
let a = parseInt(this.getAttribute("width"));
return isNaN(a) ? 0 : a;
}
set width(a) {
this.setAttribute("width", a);
}
get height() {
let a = parseInt(this.getAttribute("height"));
return isNaN(a) ? 0 : a;
}
set height(a) {
this.setAttribute("height", a);
}
get url() {
return this.getAttribute("url");
}
set url(a) {
this.setAttribute("url", a), this.shadowRoot.querySelector("img").src = a;
}
});
customElements.define("business-item", class extends Component {
static get observedAttributes() {
return [
"item-id",
"name",
"price",
"picture-url",
"item-order"
];
}
constructor(){
super(`
`);
let a = this.shadowRoot.querySelector("image-input");
this.addEventListener("image-input:uploaded", (b)=>{
b.preventDefault(), b.stopPropagation(), this.picture_url = a.url;
let c = this.shadowRoot.querySelector("form");
c.querySelector("#id").value = this.item_id, c.querySelector("#name").value = this.name, c.querySelector("#price").value = this.price, c.querySelector("#picture_url").value = this.picture_url, c.querySelector("#item_order").value = this.item_order, c.submit();
});
}
connectedCallback() {
this.item_id = this.item_id, this.name = this.name, this.price = this.price, this.picture_url = this.picture_url;
}
attributeChangedCallback(a, b, c) {
if (super.attributeChangedCallback(a, b, c), b !== c && "price" === a) return this.price = c / 100.0;
}
static get attr2FieldBlacklist() {
return [
"price"
];
}
get item_id() {
return this.getAttribute("item-id");
}
set item_id(a) {
this.setAttribute("item-id", a);
}
get item_order() {
return this.getAttribute("item-order");
}
set item_order(a) {
this.setAttribute("item-order", a);
}
get name() {
return this.getAttribute("name");
}
set name(a) {
this.setAttribute("name", a), this.shadowRoot.querySelector("#name").value = a;
}
get price() {
return this.shadowRoot.querySelector("price-input").value;
}
set price(a) {
this.setAttribute("price", a), this.shadowRoot.querySelector("price-input").value = a;
}
get picture_url() {
return this.getAttribute("picture-url");
}
set picture_url(a) {
this.setAttribute("picture-url", a), this.shadowRoot.querySelector("image-input").url = a;
}
});
customElements.define("business-items", class extends Component {
constructor(){
super(`
`);
}
});
if (!document.querySelector("#facebook-jssdk")) {
window.fbAsyncInit = ()=>{
FB.init({
appId: "1293538251053124",
cookie: !0,
xfbml: !0,
version: "v14.0"
}), FB.AppEvents.logPageView(), fireFbReady();
};
let b1 = document.createElement("script");
b1.id = "facebook-jssdk", b1.src = "https://connect.facebook.net/en_US/sdk.js", document.head.appendChild(b1);
}