(()=>{"use strict";var e={n:t=>{var n=t&&t.__esModule?()=>t.default:()=>t;return e.d(n,{a:n}),n},d:(t,n)=>{for(var l in n)e.o(n,l)&&!e.o(t,l)&&Object.defineProperty(t,l,{enumerable:!0,get:n[l]})},o:(e,t)=>Object.prototype.hasOwnProperty.call(e,t)};const t=window.React,n=window.wp.i18n,l=window.wp.element,o=window.wp.domReady;var a=e.n(o);const r=window.lodash,c=window.wp.components;function i(e){const[o,a]=(0,l.useState)(kbIconJson),i=(0,r.get)(o,["preferences","imagePref","prefix"],""),s=(0,r.get)(o,["height"],"");return(0,t.createElement)(l.Fragment,null,i?(0,t.createElement)(l.Fragment,null,(0,n.__)("Icon Set Prefix:","kadence-blocks-pro")," ",(0,t.createElement)("strong",null,i)):null,(0,t.createElement)(()=>{var e;const[r,i]=(0,l.useState)(!1),[s,d]=(0,l.useState)(!1),[p,m]=(0,l.useState)(),u=0===Object.keys(o).length,k=()=>i(!1);return(0,t.createElement)(l.Fragment,null,(0,t.createElement)(c.Button,{variant:"primary",className:"is-primary",style:{float:u?"left":"right"},onClick:()=>i(!0)},u?(0,t.createElement)(l.Fragment,null,(0,n.__)("Upload an Icon file","kadence-blocks-pro")):(0,n.__)("Replace Icon file","kadence-blocks-pro")),r&&(0,t.createElement)(c.Modal,{title:(0,n.__)("Upload Icon JSON file","kadence-blocks-pro"),onRequestClose:k},null!==(e=!1!==s)&&void 0!==e?e:(0,t.createElement)(c.Notice,{status:"error",onRemove:()=>d(!1)},(0,t.createElement)("p",null,s)),(0,n.__)("Upload the .json file from within the IcoMoon .zip file (Make sure each set has a unique prefix)","kadence-blocks-pro"),(0,t.createElement)("br",null),(0,t.createElement)("br",null),(0,n.__)("Need help?","kadence-blocks-pro")," ",(0,t.createElement)("a",{href:"https://www.kadencewp.com/kadence-blocks/documentation/pro-addon/custom-icons/",target:"_blank"},(0,n.__)("Visit the documentation here","kadence-blocks-pro")),(0,t.createElement)("br",null),(0,t.createElement)("br",null),(0,t.createElement)(c.FormFileUpload,{accept:"application/json",className:"is-primary",align:"center",onChange:e=>{m(e.target.files[0])}},(0,n.__)("Browse","kadence-blocks-pro")),p?null:(0,n.__)("Select a file","kadence-blocks-pro"),(0,t.createElement)("br",null),(0,t.createElement)("br",null),(0,t.createElement)(c.Button,{className:"is-secondary",onClick:k,text:(0,n.__)("Cancel","kadence-blocks-pro")}),"   ",(0,t.createElement)(c.Button,{className:"is-primary",disabled:!p,onClick:()=>function(e,t){const l=new FileReader;let o;l.onload=function(e){try{o=JSON.parse(e.target.result)}catch(e){return void t((0,n.__)("Invalid JSON file","kadence-blocks-pro"))}"object"==typeof o?a(o):t((0,n.__)("Invalid JSON file. File not an object.","kadence-blocks-pro"))},l.readAsText(e)}(p,d),text:(0,n.__)("Upload","kadence-blocks-pro")})))},null),(0,t.createElement)("div",{style:{display:"done"}},(0,t.createElement)("input",{type:"hidden",name:"_kb_icon_json",value:JSON.stringify(o)})),(0,t.createElement)("div",null,(0,t.createElement)("ul",{style:{display:"grid",gridTemplateColumns:"repeat(auto-fill, minmax(100px, 1fr))",gridGap:"20px",padding:"15px 15px 0",overflowY:"auto",maxHeight:"575px",listStyle:"none"}},(0,r.has)(o,["icons"])&&Object.keys(o.icons).map(e=>{const n=(0,r.get)(o,["icons",e,"width"],0),l=(0,r.get)(o,["icons",e,"height"],0);let a=0,c="0",i="0";n>l?(a=n-l,i=Math.floor(a/2)):n<l&&(a=l-n,c=Math.floor(a/2));const d=c+" "+i+" "+s+" "+(0!==n?n:s);return(0,t.createElement)("li",{className:"icon-item",style:{position:"relative",borderRadius:"3px",border:"1px solid #eee",overflow:"hidden",textAlign:"center",display:"flex",flexDirection:"column",padding:"10px 10px 0",alignItems:"center",color:"#333",justifyContent:"center"}},(0,t.createElement)("svg",{style:{display:"inline-block",verticalAlign:"middle"},viewBox:d,preserveAspectRatio:"xMinYMin meet",height:"24px",width:"24px",fill:"currentColor",xmlns:"http://www.w3.org/2000/svg"},o.icons[e].icon.paths.map(e=>(0,t.createElement)("path",{d:e}))),(0,t.createElement)("p",{style:{fontSize:"10px",fontWeight:"normal",color:"#888"}},(0,r.get)(o,["icons",e,"properties","name"],"")))}))))}a()(()=>{(0,l.render)((0,t.createElement)(i,null),document.querySelector(".kadence_replace_json_file"))}),(this.kadence=this.kadence||{})["icon-upload"]={}})();