"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}=e,c=r?.d,{frequency:o=3,triggerPercentage:i=0,trigger:n,triggerTime:g,frequencyMode:d="once",mobileTrigger:m,mobileTriggerTime:C,closeOnClickOutside:p}=s??{},{name:$,fullScreen:S,width:v,height:u,position:f,overlayColor:b,overlayOpacity:A,iconSize:B,closeButtonPosition:L,iconSvg:h}=s??{},j=s?.dialogId??a?.uid,D=system.createStateOrContext({dialogId:j,trigger:n,triggerTime:g,frequency:o,triggerPercentage:i,mobileTrigger:m,mobileTriggerTime:C,closeOnClickOutside:p,frequencyMode:d,display:c}),O=system.createAttr({...attrs.getAttr({uid:a?.uid||""})}),q=system.createStyle({...styles.getWrapperStyle(c)}),E=system.createClass({...classes.getContainClasses(r?.cssClass,A,b)}),k=system.createAttr({...attrs.getAttrContainer({uid:j||""})}),x=system.createStyle({...styles.getContainStyle()}),I=system.createClass({...classes.getBackdropClasses(f)}),P=system.createStyle({...styles.getBackdropStyle(l)}),_=system.createAttr({...attrs.getAttrOverlay()}),M=system.createClass({...classes.getOverlayClasses()}),R=system.createStyle({...styles.getOverlayStyle(A,b,l)}),z=system.createStyle({...styles.getDialogContentStyle({style:l,width:v,height:u,fullScreen:S})}),G=system.createClass({...classes.getDialogContentClasses({setting:s,enableEffect:!0,isILP:!1})}),N=system.createAttr({...attrs.getAttrClose()}),w=system.createClass({...classes.getHeadContentClasses()}),H=system.createStyle({...styles.getButtonContentStyle(s)}),J=system.createClass({...classes.getButtonContentClasses(L)}),T=system.createStyle({...styles.getSvgContentStyle(B)}),U=system.createClass({...classes.getSvgContentClasses()}),V=system.createStyle({...styles.getBodyContentStyle(s,l)}),W=system.createClass({...classes.getBodyContentClasses()}),F=()=>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="${q}"
      data-gp-setting='${JSON.stringify(D)}'>
      <dialog
        aria-label="${$}"
        ${{...k}}
        class="${E}"
        style="${x}"
      >
        <div aria-label="Backdrop" class="${I}" style="${P}">
        ${system.If(!!b,core.template`
            <div
              ${{..._}}
              class="${M}"
              style="${R}"
              aria-hidden=true
            ></div>
        `)}
          <span class="${w}"></span>
          <div
            role="dialog"
            aria-label="Dialog content"
            ${{...y}}
            class="${G}"
            style="${z}"
          >
            <button
              ${{...N}}
              type="button"
              tabindex="-1"
              class="${J}"
              style="${H}"
            >
              <span style="${T}" class="${U}">
              ${h??`<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="${V}"
              class="${W}">
                <div>
                  ${t??""}
                </div>
            </div>
          </div>
        </div>
      </dialog>
    </gp-dialog>
    ${F()}
  `};exports.default=Dialog;
