"use strict";Object.defineProperty(exports,"__esModule",{value:!0});var core=require("@gem-sdk/core"),system=require("@gem-sdk/system"),attrs=require("../common/attrs.js"),styles=require("../common/styles.js"),classes=require("../common/classes.js"),helpers=require("../../helpers.js");const Dialog=e=>{let{setting:s,children:t,builderProps:a,style:l,advanced:r,builderAttrs:y,pageContext:c}=e,o=r?.d,{frequency:i=3,triggerPercentage:n=0,trigger:g,triggerTime:d,frequencyMode:m="once",mobileTrigger:C,mobileTriggerTime:p,closeOnClickOutside:$}=s??{},{name:S,fullScreen:u,width:v,height:f,position:b,overlayColor:A,overlayOpacity:L,iconSize:B,closeButtonPosition:h,iconSvg:j}=s??{},q=s?.dialogId??a?.uid,D=system.createStateOrContext({dialogId:q,trigger:g,triggerTime:d,frequency:i,triggerPercentage:n,mobileTrigger:C,mobileTriggerTime:p,closeOnClickOutside:$,frequencyMode:m,display:o}),O=system.createAttr({...attrs.getAttr({uid:a?.uid||""})}),x=system.createStyle({...styles.getWrapperStyle(o)}),E=system.createClass({...classes.getContainClasses(r?.cssClass,L,A)}),k=system.createAttr({...attrs.getAttrContainer({uid:q||""})}),I=system.createStyle({...styles.getContainStyle()}),P=system.createClass({...classes.getBackdropClasses(b)}),_=system.createStyle({...styles.getBackdropStyle(l)}),M=system.createAttr({...attrs.getAttrOverlay()}),R=system.createClass({...classes.getOverlayClasses()}),z=system.createStyle({...styles.getOverlayStyle(L,A,l)}),G=system.createStyle({...styles.getDialogContentStyle({style:l,width:v,height:f,fullScreen:u})}),N=system.createClass({...classes.getDialogContentClasses({setting:s,enableEffect:!0,isILP:!1})}),w=system.createAttr({...attrs.getAttrClose()}),H=system.createClass({...classes.getHeadContentClasses()}),J=system.createStyle({...styles.getButtonContentStyle(s)}),T=system.createClass({...classes.getButtonContentClasses(h)}),U=system.createStyle({...styles.getSvgContentStyle(B)}),V=system.createClass({...classes.getSvgContentClasses()}),W=system.createStyle({...styles.getBodyContentStyle({setting:s,style:l,uid:a?.uid,pageContext:c??{},type:"Liquid"})}),F=system.createClass({...classes.getBodyContentClasses()}),K=()=>core.RenderIf(core.isLocalEnv,'<script src="{{ \'gp-dialog-v7-5.js\' | asset_url }}" defer="defer"></script>',`<script src="${core.baseAssetURL}/assets-v2/gp-dialog-v7-5.js?v={{ shop.metafields.GEMPAGES.ASSETS_VERSION }}" defer="defer"></script>`);return core.template`
    <gp-dialog
      ${{...O}}
      class="${helpers.getSettingPreloadData("gps-lazy")}"
      style="${x}"
      data-gp-setting='${JSON.stringify(D)}'>
      <dialog
        aria-label="${S}"
        ${{...k}}
        class="${E}"
        style="${I}"
      >
        <div aria-label="Backdrop" class="${P}" style="${_}">
        ${system.If(!!A,core.template`
            <div
              ${{...M}}
              class="${R}"
              style="${z}"
              aria-hidden=true
            ></div>
        `)}
          <span class="${H}"></span>
          <div
            role="dialog"
            aria-label="Dialog content"
            ${{...y}}
            class="${N}"
            style="${G}"
          >
            <button
              ${{...w}}
              type="button"
              tabindex="-1"
              class="${T}"
              style="${J}"
            >
              <span style="${U}" class="${V}">
              ${j??`<svg viewBox="0 0 12 12" fill="currentColor" style={svgContentStyle}>
                <path d="M7.1,6l4.5,4.5l-1.1,1.1L6,7.1l-4.5,4.5l-1.1-1.1L4.9,6L0.5,1.5l1.1-1.1L6,4.9l4.5-4.5l1.1,1.1L7.1,6z"></path>
              </svg>`}
              </span>
            </button>
            <div
              aria-label="Dialog body"
              style="${W}"
              class="${F}">
                <div>
                  ${t??""}
                </div>
            </div>
          </div>
        </div>
      </dialog>
    </gp-dialog>
    ${K()}
  `};exports.default=Dialog;
