import{r as e,h as t}from"./p-9add63ef.js";import{o as r}from"./p-4773325d.js";function n(e,t,r){t=typeof t==="number"?d(t.toString()):typeof t==="string"?d(t):t;const n=(e,t,r,i)=>{let s,l=t[i];if(t.length>i){if(Array.isArray(e)){l=a(l,e);s=e.slice()}else{s=Object.assign({},e)}s[l]=n(e[l]!==undefined?e[l]:{},t,r,i+1);return s}return typeof r==="function"?r(e):r};return n(e,t,r,0)}function i(e,t,r){t=typeof t==="number"?d(t.toString()):typeof t==="string"?d(t):t;for(var n=0;n<t.length;n++){if(e===null||typeof e!=="object"){return r}let i=t[n];if(Array.isArray(e)&&i==="$end"){i=e.length-1}e=e[i]}if(typeof e==="undefined"){return r}return e}function s(e,t){t=typeof t==="number"?d(t.toString()):typeof t==="string"?d(t):t;const r=(e,t,n)=>{let i,s=t[n];if(e===null||typeof e!=="object"||!Array.isArray(e)&&e[s]===undefined){return e}if(t.length-1>n){if(Array.isArray(e)){s=a(s,e);i=e.slice()}else{i=Object.assign({},e)}i[s]=r(e[s],t,n+1);return i}if(Array.isArray(e)){s=a(s,e);i=[].concat(e.slice(0,s),e.slice(s+1))}else{i=Object.assign({},e);delete i[s]}return i};return r(e,t,0)}function l(e,t){const r=i(e,t);return n(e,t,!Boolean(r))}function o(e,t,r){const s=i(e,t);if(typeof s==="object"){if(Array.isArray(s)){return n(e,t,s.concat(r))}else if(s===null){return n(e,t,r)}else{let i=Object.assign({},s,r);return n(e,t,i)}}else if(typeof s==="undefined"){return n(e,t,r)}else{return e}}function a(e,t){if(e==="$end"){e=Math.max(t.length-1,0)}if(!/^\+?\d+$/.test(e)){throw new Error(`Array index '${e}' has to be an integer`)}return parseInt(e)}function d(e){return e.split(".").reduce(((e,t,r,n)=>{const i=r>0&&n[r-1];if(i&&/(?:^|[^\\])\\$/.test(i)){const r=e.pop();e.push(r.slice(0,-1)+"."+t)}else{e.push(t)}return e}),[])}var u={set:n,get:i,delete:s,toggle:l,merge:o};const f=":host{display:block}.order-detail__value{display:block;font-weight:var(--sc-font-weight-semibold);line-height:var(--sc-line-height-dense)}.order-detail__label{display:block;color:var(--sc-color-gray-500);line-height:var(--sc-line-height-dense)}";const c=f;const h=class{constructor(t){e(this,t);this.order=undefined;this.value=undefined;this.fallback=undefined;this.metaKey=undefined;this.loading=undefined;this.label=undefined}getPropByPath(e,t,r){if(e&&t.length)return this.getPropByPath(e[t.shift()],t,r);return e===undefined?r:e}getValue(){var e,r;if(!this.value){return}let n="";if(this.value==="metadata"){return u.get((e=this===null||this===void 0?void 0:this.order)===null||e===void 0?void 0:e.metadata,this.value||"")}n=u.get(this===null||this===void 0?void 0:this.order,this.value||"");if(typeof n==="number"){n=t("sc-format-number",{type:"currency",currency:(r=this===null||this===void 0?void 0:this.order)===null||r===void 0?void 0:r.currency,value:n})}return n}render(){if(this.loading){return t("div",{part:"base",class:{"order-detail":true}},t("span",{part:"label",class:"order-detail__label"},t("sc-skeleton",{style:{width:"60px",height:"8px",display:"inline-block"}})),t("span",{part:"value",class:"order-detail__value"},t("sc-skeleton",{style:{width:"120px",display:"inline-block"}})))}const e=this.getValue();if(!e){if(!this.fallback){return}}return t("div",{part:"base",class:{"order-detail":true}},t("span",{part:"label",class:"order-detail__label"},t("slot",{name:"label"},this.label)),t("span",{part:"value",class:"order-detail__value"},t("slot",{name:"value"},e||this.fallback)))}};r(h,["order","loading"],false);h.style=c;export{h as sc_order_detail};
//# sourceMappingURL=p-4e62e6a2.entry.js.map