import{r as e,h as t}from"./p-b891c2f1.js";import{o as r}from"./p-494248b1.js";function n(e,t,r){t="number"==typeof t?i(t.toString()):"string"==typeof t?i(t):t;const n=(e,t,r,o)=>{let i,s=t[o];return t.length>o?(Array.isArray(e)?(s=l(s,e),i=e.slice()):i=Object.assign({},e),i[s]=n(void 0!==e[s]?e[s]:{},t,r,o+1),i):"function"==typeof r?r(e):r};return n(e,t,r,0)}function o(e,t,r){t="number"==typeof t?i(t.toString()):"string"==typeof t?i(t):t;for(var n=0;n<t.length;n++){if(null===e||"object"!=typeof e)return r;let o=t[n];Array.isArray(e)&&"$end"===o&&(o=e.length-1),e=e[o]}return void 0===e?r:e}function l(e,t){if("$end"===e&&(e=Math.max(t.length-1,0)),!/^\+?\d+$/.test(e))throw new Error(`Array index '${e}' has to be an integer`);return parseInt(e)}function i(e){return e.split(".").reduce(((e,t,r,n)=>{const o=r>0&&n[r-1];if(o&&/(?:^|[^\\])\\$/.test(o)){const r=e.pop();e.push(r.slice(0,-1)+"."+t)}else e.push(t);return e}),[])}var s={set:n,get:o,delete:function(e,t){t="number"==typeof t?i(t.toString()):"string"==typeof t?i(t):t;const r=(e,t,n)=>{let o,i=t[n];return null===e||"object"!=typeof e||!Array.isArray(e)&&void 0===e[i]?e:t.length-1>n?(Array.isArray(e)?(i=l(i,e),o=e.slice()):o=Object.assign({},e),o[i]=r(e[i],t,n+1),o):(Array.isArray(e)?(i=l(i,e),o=[].concat(e.slice(0,i),e.slice(i+1))):(o=Object.assign({},e),delete o[i]),o)};return r(e,t,0)},toggle:function(e,t){const r=o(e,t);return n(e,t,!Boolean(r))},merge:function(e,t,r){const l=o(e,t);return"object"==typeof l?Array.isArray(l)?n(e,t,l.concat(r)):n(e,t,null===l?r:Object.assign({},l,r)):void 0===l?n(e,t,r):e}};const a=class{constructor(t){e(this,t)}getPropByPath(e,t,r){return e&&t.length?this.getPropByPath(e[t.shift()],t,r):void 0===e?r:e}getValue(){var e,r;if(!this.value)return;let n="";return"metadata"===this.value?s.get(null===(e=null==this?void 0:this.order)||void 0===e?void 0:e.metadata,this.value||""):(n=s.get(null==this?void 0:this.order,this.value||""),"number"==typeof n&&(n=t("sc-format-number",{type:"currency",currency:null===(r=null==this?void 0:this.order)||void 0===r?void 0:r.currency,value:n})),n)}render(){if(this.loading)return t("div",{part:"base",class:{"order-detail":!0}},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();return e||this.fallback?t("div",{part:"base",class:{"order-detail":!0}},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))):void 0}};r(a,["order","loading"],!1),a.style=":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)}";export{a as sc_order_detail}