PageSourceSearch

https://vograce.jp/cdn/shop/t/16/assets/vog-add-method-DXrI85VB.min.js?v=117159225416922361351787036416

js vograce.jp collected 2026-10-08 10:30:41 UTC 6,398 bytes, 1 lines download raw bytes

1import{p as e}from"vog-frontend-error-reporter";import{$t as t,E as n,Ft as r,Ht as i,It as a,Kt as o,T as s,an as c,c as l,cn as u,l as d,on as f,s as p,u as m,un as h}from"vog-lib";var g=e=>{e.hidden=!1,e.dataset.visibility=`visible`},_=e=>{e.hidden=!0,e.dataset.visibility=`hidden`},v=new h(`Popup`);const y=new Map;window.__VOGRACE_POPUP__=y;var b={TRIGGER:`[data-trigger='popup']`,DISMISS:`[data-dismiss='popup']`,CONTENT:`.vograce-popup__content`,POPUP:`.vograce-popup`,CONTAINER:`#vog-popup-container`},x=11001,S=`popup-template`,C=class{constructor(t,n,i=null){e(this,`id`,void 0),e(this,`_popupRef`,void 0),e(this,`_triggerRef`,void 0),e(this,`zIndex`,void 0),e(this,`_contentRef`,void 0),e(this,`_dismissRefs`,void 0),this.id=n,this._popupRef=t,this._triggerRef=i,this.zIndex=x+y.size,this._contentRef=r(this._popupRef,b.CONTENT),this._dismissRefs=a(this._popupRef,b.DISMISS),this._init()}_init(){this._popupRef&&(this._setZIndex(),this._bindEvents())}_setZIndex(){this._popupRef&&(this._popupRef.style.zIndex=String(this.zIndex))}_bindEvents(){this._triggerRef&&o(this._triggerRef,`click`,e=>{l(this._triggerRef)&&(e.preventDefault(),this.open())}),this._dismissRefs.forEach(e=>{o(e,`click`,this.close.bind(this))})}open(){this._popupRef&&(v.info(`Opening popup element`,{id:this.id}),g(this._popupRef),s(),m.emit(d.POPUP.OPEN,this.id,this._popupRef,this))}close(){this._popupRef&&(_(this._popupRef),n(),m.emit(d.POPUP.CLOSE,this.id,this._popupRef))}updateElement(e){e&&(this._popupRef=e,this._contentRef=r(this._popupRef,b.CONTENT),this._dismissRefs=a(this._popupRef,b.DISMISS),this._init())}destroy(){this._triggerRef&&this._triggerRef.removeEventListener(`click`,this.open.bind(this)),this._dismissRefs.forEach(e=>{e.removeEventListener(`click`,this.close.bind(this))}),this._popupRef=null,this._triggerRef=null,this._contentRef=null,this._dismissRefs=[]}};const w=new class{constructor(){e(this,`_injectedIds`,new Set),e(this,`_tplRef`,null),e(this,`_isReady`,!1),e(this,`_containerRef`,null),e(this,`_templatePromise`,null),e(this,`_boundOnTriggerClick`,this._onTriggerClick.bind(this)),e(this,`_boundOnDismissClick`,this._onDismissClick.bind(this)),this._init()}async _init(){v.info(`Initializing popup manager`),this._containerRef=r(b.CONTAINER),this.syncTemplateRefFromDOM(),this._setupEventListeners(),this._initStaticPopups()}syncTemplateRefFromDOM(){let e=document.getElementById(`vog-template--${S}`);e&&(this._tplRef=e,this._isReady=!0)}async _loadAndInjectTemplate(){return this._templatePromise||(this._templatePromise=(async()=>{try{return this.syncTemplateRefFromDOM(),this._tplRef?(this._isReady=!0,this._tplRef):(v.error(`Template not available: expected vog-popup-template rendered by Liquid`),null)}catch(e){return v.error(`Failed to load template`,e),null}finally{this._templatePromise=null}})()),this._templatePromise}_setupEventListeners(){o(document.body,`click`,this._boundOnTriggerClick),this._containerRef&&o(this._containerRef,`click`,this._boundOnDismissClick)}_initStaticPopups(){a(b.TRIGGER).forEach(e=>{let n=t(e,`data-target`);if(n){let t=r(n);if(t&&!y.has(n)){let r=new C(t,n,e);r._popupRef&&y.set(n,r)}}})}_onTriggerClick(e){let n=e.target.closest(b.TRIGGER);if(!n||!l(n))return;let r=t(n,`data-target`);r&&this.open(r,n)}async open(e,t=null){v.info(`Opening popup`,{target:e,fromTrigger:!!t}),this.syncTemplateRefFromDOM(),!this._isReady&&!this._tplRef&&await this._loadAndInjectTemplate();let n=await this._getOrCreatePopupElement(e);if(!n)return v.warn(`Failed to get or create popup element for "${e}"`),null;if(y.has(e)){let t=y.get(e);return t._popupRef!==n&&t.updateElement(n),t.open(),t}else{let r=new C(n,e,t);if(r._popupRef)return y.set(e,r),r.open(),r}return null}close(e,t){let r=y.get(e);r?r.close():t&&(_(t),m.emit(d.POPUP.CLOSE,e,t)),n()}async _getOrCreatePopupElement(e){let t=r(e);if(t)return t;if(this._isReady&&this._tplRef&&this._containerRef){if(this._injectedIds.has(e)){if(t=r(this._containerRef,e),t)return t;this._injectedIds.delete(e)}if(t=this._tplRef.content.cloneNode(!0).querySelector(b.POPUP),t)return t.id=e.replace(/^#/,``),this._containerRef.appendChild(t),this._injectedIds.add(e),t}return null}_onDismissClick(e){let t=e.target.closest(b.DISMISS);if(!t)return;let n=t.closest(b.POPUP);if(!n)return;let r=n.id?`#${n.id}`:null;r&&(this.close(r,n),v.info(`Closed "${r}"`))}};async function T(e){let{id:t,width:a=750,title:l,content:d,showCancelButton:m=!1,cancelButtonText:h=`Cancel`,showConfirmButton:g=!0,confirmButtonText:y=`Confirm`,buildConfirmButton:x,buildCancelButton:S,onCancel:C=p,onClose:T=p,onConfirm:E=p}=e;if(v.info(`showPopup called`,{id:t,hasTitle:!!l,hasContent:!!d,showCancelButton:m,showConfirmButton:g}),w.syncTemplateRefFromDOM(),!w._isReady&&!w._tplRef&&await w._loadAndInjectTemplate(),!w._tplRef){v.error(`Template not available`);return}let D=w._tplRef.content.cloneNode(!0).querySelector(b.POPUP);if(!D){v.error(`Failed to clone template`);return}D.id=`VogracePopup-${t}`,D.classList.add(`vograce-popup--confirm`);let O=r(D,`.vograce-popup__content`);if(O){let e=i()?`100%`:f(a)?`${a}px`:a;O.style.width=String(e)}let k=r(D,`.vograce-popup__body`);if(k){let e=r(k,`.vograce-close-button`);if(l||d){let t=``;l&&(t+=`<h2 class="vograce-typography vograce-popup__title">${l}</h2>`),d&&(u(d)?t+=d:t+=d.outerHTML),t&&(e?e.insertAdjacentHTML(`afterend`,t):k.insertAdjacentHTML(`afterbegin`,t))}let t=r(k,`.vograce-popup__buttons`),n=null,i=null;if(t){let e=r(t,`[data-action="cancel"]`),a=r(t,`[data-action="confirm"]`);m?c(S)?(n=S(),e?e.replaceWith(n):t.appendChild(n)):e&&(n=e,n.textContent=h):e&&e.remove(),g?c(x)?(i=x(),a?a.replaceWith(i):t.appendChild(i)):a&&(i=a,i.textContent=y):a&&a.remove(),m||g?t.style.display=``:t.style.display=`none`}}let A=()=>{i()&&n(),_(D),D.removeEventListener(`click`,N),D.remove(),n()},j=()=>C(A),M=()=>E(A),N=e=>{let t=e.target;if(t.closest(`[data-dismiss="popup"]`)){A(),T();return}if(t.closest(`[data-action="cancel"]`)){j();return}t.closest(`[data-action="confirm"]`)&&M()};s(),o(D,`click`,N),i()&&s(),document.body.appendChild(D)}function E(e,t){return w.open(e,t)}function D(e){return w.close(e)}var O=`#addMethodDialog`;function k(){return y.has(O)||document.querySelector(O)!=null}function A(){if(!k())return!1;let e=y.get(O);
1return e&&typeof e.open==`function`?e.open():E(O),m.emit(d.POPUP.ADD_METHOD_OPEN),!0}export{T as a,E as i,A as n,D as r,k as t};

Line numbers count LF bytes from the start of the resource, as the search results do. Vendor segments are library code the classifier recognised; they are stored but not indexed. Bytes are shown as Latin1 characters, one per byte.