import{proxyCustomElement,HTMLElement,h}from"@stencil/core/internal/client";import{o as openWormhole}from"./consumer.js";import{d as defineCustomElement$3}from"./sc-format-number2.js";import{d as defineCustomElement$2}from"./sc-skeleton2.js";function set(e,t,r){t="number"==typeof t?propToArray(t.toString()):"string"==typeof t?propToArray(t):t;const s=(e,t,r,o)=>{let l,n=t[o];return t.length>o?(Array.isArray(e)?(n=getArrayIndex(n,e),l=e.slice()):l=Object.assign({},e),l[n]=s(void 0!==e[n]?e[n]:{},t,r,o+1),l):"function"==typeof r?r(e):r};return s(e,t,r,0)}function get(e,t,r){t="number"==typeof t?propToArray(t.toString()):"string"==typeof t?propToArray(t):t;for(var s=0;s<t.length;s++){if(null===e||"object"!=typeof e)return r;let o=t[s];Array.isArray(e)&&"$end"===o&&(o=e.length-1),e=e[o]}return void 0===e?r:e}function _delete(e,t){t="number"==typeof t?propToArray(t.toString()):"string"==typeof t?propToArray(t):t;const r=(e,t,s)=>{let o,l=t[s];return null===e||"object"!=typeof e||!Array.isArray(e)&&void 0===e[l]?e:t.length-1>s?(Array.isArray(e)?(l=getArrayIndex(l,e),o=e.slice()):o=Object.assign({},e),o[l]=r(e[l],t,s+1),o):(Array.isArray(e)?(l=getArrayIndex(l,e),o=[].concat(e.slice(0,l),e.slice(l+1))):(o=Object.assign({},e),delete o[l]),o)};return r(e,t,0)}function toggle(e,t){const r=get(e,t);return set(e,t,!Boolean(r))}function merge(e,t,r){const s=get(e,t);return"object"==typeof s?Array.isArray(s)?set(e,t,s.concat(r)):set(e,t,null===s?r:Object.assign({},s,r)):void 0===s?set(e,t,r):e}function getArrayIndex(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 propToArray(e){return e.split(".").reduce(((e,t,r,s)=>{const o=r>0&&s[r-1];if(o&&/(?:^|[^\\])\\$/.test(o)){const r=e.pop();e.push(r.slice(0,-1)+"."+t)}else e.push(t);return e}),[])}var lib={set:set,get:get,delete:_delete,toggle:toggle,merge:merge};const scOrderDetailCss=":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)}",ScOrderDetailStyle0=scOrderDetailCss,ScSessionDetail=proxyCustomElement(class extends HTMLElement{constructor(){super(),this.__registerHost(),this.__attachShadow(),this.order=void 0,this.value=void 0,this.fallback=void 0,this.metaKey=void 0,this.loading=void 0,this.label=void 0}getPropByPath(e,t,r){return e&&t.length?this.getPropByPath(e[t.shift()],t,r):void 0===e?r:e}getValue(){var e,t;if(!this.value)return;let r="";return"metadata"===this.value?lib.get(null===(e=null==this?void 0:this.order)||void 0===e?void 0:e.metadata,this.value||""):(r=lib.get(null==this?void 0:this.order,this.value||""),"number"==typeof r&&(r=h("sc-format-number",{type:"currency",currency:null===(t=null==this?void 0:this.order)||void 0===t?void 0:t.currency,value:r})),r)}render(){if(this.loading)return h("div",{part:"base",class:{"order-detail":!0}},h("span",{part:"label",class:"order-detail__label"},h("sc-skeleton",{style:{width:"60px",height:"8px",display:"inline-block"}})),h("span",{part:"value",class:"order-detail__value"},h("sc-skeleton",{style:{width:"120px",display:"inline-block"}})));const e=this.getValue();return e||this.fallback?h("div",{part:"base",class:{"order-detail":!0}},h("span",{part:"label",class:"order-detail__label"},h("slot",{name:"label"},this.label)),h("span",{part:"value",class:"order-detail__value"},h("slot",{name:"value"},e||this.fallback))):void 0}static get style(){return ScOrderDetailStyle0}},[1,"sc-order-detail",{order:[16],value:[1],fallback:[1],metaKey:[1,"meta-key"],loading:[4],label:[1]}]);function defineCustomElement$1(){"undefined"!=typeof customElements&&["sc-order-detail","sc-format-number","sc-skeleton"].forEach((e=>{switch(e){case"sc-order-detail":customElements.get(e)||customElements.define(e,ScSessionDetail);break;case"sc-format-number":customElements.get(e)||defineCustomElement$3();break;case"sc-skeleton":customElements.get(e)||defineCustomElement$2()}}))}openWormhole(ScSessionDetail,["order","loading"],!1);const ScOrderDetail=ScSessionDetail,defineCustomElement=defineCustomElement$1;export{ScOrderDetail,defineCustomElement};