import*as e from"@wordpress/interactivity";var t,n,o={d:function(e,t){for(var n in t)o.o(t,n)&&!o.o(e,n)&&Object.defineProperty(e,n,{enumerable:!0,get:t[n]})},o:function(e,t){return Object.prototype.hasOwnProperty.call(e,t)}},r=(t={getContext:function(){return e.getContext},getElement:function(){return e.getElement},store:function(){return e.store},useEffect:function(){return e.useEffect}},n={},o.d(n,t),n);(0,r.store)("surecart/line-item-note",{actions:{toggleNoteExpanded(e){if((e=>"keydown"===e.type&&"Enter"!==e.key&&" "!==e.key)(e))return!0;const t=(0,r.getContext)();t&&(t.noteExpanded=!t.noteExpanded)}},callbacks:{init(){const e=(0,r.getContext)();(0,r.useEffect)((()=>{const{ref:t}=(0,r.getElement)();if(!t||!e)return;const n=t.querySelector(".line-item-note__text");if(!n)return void(e.showToggle=!1);const o=()=>{e.showToggle=!!e.noteExpanded||n.scrollHeight>n.clientHeight};o();const c=new ResizeObserver(o);return c.observe(n),()=>c.disconnect()}),[])}}});