New Case Study:See how Anthropic automated 95% of dependency reviews with Socket.Learn More
Socket
Sign inDemoInstall
Socket

@arrowshq/embed-core

Package Overview
Dependencies
Maintainers
1
Versions
6
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

@arrowshq/embed-core - npm Package Compare versions

Comparing version 0.0.1 to 0.0.2

dist/assets/sdk-action-manager-2498e06f.js

18

dist/embed.js

@@ -1,5 +0,5 @@

!function(){const L=({buttonText:a,buttonClasses:t,buttonColor:r,buttonTextColor:e})=>`
!function(){import{S as x}from"./assets/sdk-action-manager-2498e06f.js";const I=({buttonText:s,buttonClasses:t,buttonColor:r,buttonTextColor:o})=>`
<button
class="z-[999999999999] hidden fixed md:bottom-6 bottom-4 md:right-10 right-4 md:left-10 left-4 ${t.join(" ")} flex h-16 origin-center bg-red-50 transform cursor-pointer items-center rounded-full py-4 px-6 text-base outline-none drop-shadow-md transition focus:outline-none focus:ring-4 focus:ring-gray-600 focus:ring-opacity-50 active:scale-95"
style="background-color:${r}; color:${e} z-index: 10001"
style="background-color:${r}; color:${o} z-index: 10001"
>

@@ -22,5 +22,5 @@ <div id="button-icon" class="mr-3 flex items-center justify-center">

</div>
<div id="button" class="font-semibold leading-5 antialiased">${a}</div>
</button>`,z=["data-button-text","data-hide-button-icon","data-button-position","data-button-color","data-button-text-color","data-toggle-off"];class m extends HTMLElement{constructor(){super();const t=this.dataset,r=t.buttonText,e=t.buttonPosition,o=t.buttonColor,i=t.buttonTextColor,s=`<style>${window.Arrows.__css}</style> ${L({buttonText:r,buttonClasses:[m.updatedClassString(e,"")],buttonColor:o,buttonTextColor:i})}`;this.attachShadow({mode:"open"}),this.assertHasShadowRoot(),this.shadowRoot.innerHTML=s}static updatedClassString(t,r){return[r.replace(/hidden|md:right-10|md:left-10|left-4|right-4/g,""),t==="bottom-right"?"md:right-10 right-4":"md:left-10 left-4"].join(" ")}static get observedAttributes(){return z}attributeChangedCallback(t,r,e){var n,d,h;const o=(n=this.shadowRoot)==null?void 0:n.querySelector("#button"),i=(d=this.shadowRoot)==null?void 0:d.querySelector("button"),s=(h=this.shadowRoot)==null?void 0:h.querySelector("#button-icon");if(!o)throw new Error("#button not found");if(!i)throw new Error("button element not found");if(!s)throw new Error("#button-icon not found");if(t==="data-button-text")o.textContent=e;else if(t==="data-hide-button-icon")s.style.display=e=="true"?"none":"block";else if(t==="data-button-position")i.className=m.updatedClassString(e,i.className);else if(t==="data-button-color")i.style.backgroundColor=e;else if(t==="data-button-text-color")i.style.color=e;else if(t==="data-toggle-off"){const w=e=="true";w&&(this.buttonWrapperStyleDisplay=i.style.display),i.style.display=w?"none":this.buttonWrapperStyleDisplay}else console.log("Unknown attribute changed",t,r,e)}assertHasShadowRoot(){if(!this.shadowRoot)throw new Error("No shadow root")}}const k=`@keyframes loader{0%{transform:rotate(0)}25%{transform:rotate(180deg)}50%{transform:rotate(180deg)}75%{transform:rotate(360deg)}to{transform:rotate(360deg)}}@keyframes loader-inner{0%{height:0%}25%{height:0%}50%{height:100%}75%{height:100%}to{height:0%}}.loader-inner{vertical-align:top;display:inline-block;width:100%;animation:loader-inner 2s infinite ease-in}.loader{display:block;width:30px;height:30px;position:relative;border-width:4px;border-style:solid;animation:loader 2s infinite ease}.loader.modal-loader{margin:60px auto}
`,E=a=>a==="404"?"Error Code: 404. Arrows Link seems to be wrong.":`Error Code: ${a}. Something went wrong.`,N=`
<div id="button" class="font-semibold leading-5 antialiased">${s}</div>
</button>`,z=["data-button-text","data-hide-button-icon","data-button-position","data-button-color","data-button-text-color","data-toggle-off"];class m extends HTMLElement{constructor(){super();const t=this.dataset,r=t.buttonText,o=t.buttonPosition,e=t.buttonColor,i=t.buttonTextColor,a=`<style>${window.Arrows.__css}</style> ${I({buttonText:r,buttonClasses:[m.updatedClassString(o,"")],buttonColor:e,buttonTextColor:i})}`;this.attachShadow({mode:"open"}),this.assertHasShadowRoot(),this.shadowRoot.innerHTML=a}static updatedClassString(t,r){return[r.replace(/hidden|md:right-10|md:left-10|left-4|right-4/g,""),t==="bottom-right"?"md:right-10 right-4":"md:left-10 left-4"].join(" ")}static get observedAttributes(){return z}attributeChangedCallback(t,r,o){var n,d,h;const e=(n=this.shadowRoot)==null?void 0:n.querySelector("#button"),i=(d=this.shadowRoot)==null?void 0:d.querySelector("button"),a=(h=this.shadowRoot)==null?void 0:h.querySelector("#button-icon");if(!e)throw new Error("#button not found");if(!i)throw new Error("button element not found");if(!a)throw new Error("#button-icon not found");if(t==="data-button-text")e.textContent=o;else if(t==="data-hide-button-icon")a.style.display=o=="true"?"none":"block";else if(t==="data-button-position")i.className=m.updatedClassString(o,i.className);else if(t==="data-button-color")i.style.backgroundColor=o;else if(t==="data-button-text-color")i.style.color=o;else if(t==="data-toggle-off"){const w=o=="true";w&&(this.buttonWrapperStyleDisplay=i.style.display),i.style.display=w?"none":this.buttonWrapperStyleDisplay}else console.log("Unknown attribute changed",t,r,o)}assertHasShadowRoot(){if(!this.shadowRoot)throw new Error("No shadow root")}}const k=`@keyframes loader{0%{transform:rotate(0)}25%{transform:rotate(180deg)}50%{transform:rotate(180deg)}75%{transform:rotate(360deg)}to{transform:rotate(360deg)}}@keyframes loader-inner{0%{height:0%}25%{height:0%}50%{height:100%}75%{height:100%}to{height:0%}}.loader-inner{vertical-align:top;display:inline-block;width:100%;animation:loader-inner 2s infinite ease-in}.loader{display:block;width:30px;height:30px;position:relative;border-width:4px;border-style:solid;animation:loader 2s infinite ease}.loader.modal-loader{margin:60px auto}
`,E=s=>s==="404"?"Error Code: 404. Arrows Link seems to be wrong.":`Error Code: ${s}. Something went wrong.`,L=`
<div id="wrapper" style="top:50%; left:50%;transform:translate(-50%,-50%)" class="absolute z-highest">

@@ -35,3 +35,3 @@ <div class="loader border-brand-default dark:border-darkmodebrand">

<slot></slot>
`;class H extends HTMLElement{static get observedAttributes(){return["loading"]}assertHasShadowRoot(){if(!this.shadowRoot)throw new Error("No shadow root")}attributeChangedCallback(t,r,e){this.assertHasShadowRoot();const o=this.shadowRoot.querySelector(".loader"),i=this.shadowRoot.querySelector("#error"),s=this.shadowRoot.querySelector("slot");if(!o||!s||!i)throw new Error("One of loaderEl, slotEl or errorEl is missing");if(t==="loading"){if(e=="done")o.style.display="none";else if(e==="failed"){o.style.display="none",s.style.visibility="hidden",i.style.display="block";const n=E(this.dataset.errorCode);i.innerText=n}}}constructor(){super(),this.attachShadow({mode:"open"}),this.assertHasShadowRoot(),this.shadowRoot.innerHTML=`<style>${window.Arrows.__css}</style><style>${k}</style>${N}`}}const q=`
`;class H extends HTMLElement{static get observedAttributes(){return["loading"]}assertHasShadowRoot(){if(!this.shadowRoot)throw new Error("No shadow root")}attributeChangedCallback(t,r,o){this.assertHasShadowRoot();const e=this.shadowRoot.querySelector(".loader"),i=this.shadowRoot.querySelector("#error"),a=this.shadowRoot.querySelector("slot");if(!e||!a||!i)throw new Error("One of loaderEl, slotEl or errorEl is missing");if(t==="loading"){if(o=="done")e.style.display="none";else if(o==="failed"){e.style.display="none",a.style.visibility="hidden",i.style.display="block";const n=E(this.dataset.errorCode);i.innerText=n}}}constructor(){super(),this.attachShadow({mode:"open"}),this.assertHasShadowRoot(),this.shadowRoot.innerHTML=`<style>${window.Arrows.__css}</style><style>${k}</style>${L}`}}const q=`
<style>

@@ -94,5 +94,5 @@ .my-backdrop {

</div>
`;class g extends HTMLElement{static get observedAttributes(){return["state"]}assertHasShadowRoot(){if(!this.shadowRoot)throw new Error("No shadow root")}show(t){this.assertHasShadowRoot(),this.shadowRoot.host.style.visibility=t?"visible":"hidden",t||(document.body.style.overflow=g.htmlOverflow)}open(){this.show(!0);const t=new Event("open");this.dispatchEvent(t)}close(){this.show(!1);const t=new Event("close");this.dispatchEvent(t)}getLoaderElement(){this.assertHasShadowRoot();const t=this.shadowRoot.querySelector(".loader");if(!t)throw new Error("No loader element");return t}getErrorElement(){this.assertHasShadowRoot();const t=this.shadowRoot.querySelector("#error");if(!t)throw new Error("No error element");return t}attributeChangedCallback(t,r,e){if(t==="state"){if(e=="loaded")this.getLoaderElement().style.display="none";else if(e==="started")this.open();else if(e=="closed")this.close();else if(e==="failed"){this.getLoaderElement().style.display="none",this.getErrorElement().style.display="inline-block";const o=E(this.dataset.errorCode);this.getErrorElement().innerText=o}}}connectedCallback(){this.assertHasShadowRoot();const t=this.shadowRoot.querySelector(".close");document.addEventListener("keydown",r=>{r.key==="Escape"&&this.close()},{once:!0}),this.shadowRoot.host.addEventListener("click",()=>{this.close()}),t&&(t.onclick=()=>{this.close()})}constructor(){super();const t=`<style>${window.Arrows.__css}</style><style>${k}</style>${q}`;this.attachShadow({mode:"open"}),g.htmlOverflow=document.body.style.overflow,document.body.style.overflow="hidden",this.open(),this.assertHasShadowRoot(),this.shadowRoot.innerHTML=t}}const _=`.arrows-embed{border:0px;min-height:300px;margin:0 auto;width:100%}
`;function b(a,t){const r=new window.CustomEvent(a,{detail:t});window.dispatchEvent(r)}class S{static parseAction(t){if(!t)return null;const[r,e,o]=t.split(":");return r!=="ARROWS"?null:{ns:e,type:o}}getFullActionName(t){return this.namespace?`ARROWS:${this.namespace}:${t}`:`ARROWS::${t}`}fire(t,r){const e=this.getFullActionName(t),o={type:t,namespace:this.namespace,fullType:e,data:r};b(e,o),b(this.getFullActionName("*"),o)}on(t,r){const e=this.getFullActionName(t);window.addEventListener(e,r)}off(t,r){const e=this.getFullActionName(t);window.removeEventListener(e,r)}constructor(t){t=t||"",this.namespace=t}}const $=`*,:before,:after{box-sizing:border-box;border-width:0;border-style:solid;border-color:#e5e7eb}:before,:after{--tw-content: ""}html{line-height:1.5;-webkit-text-size-adjust:100%;-moz-tab-size:4;-o-tab-size:4;tab-size:4;font-family:Inter var,ui-sans-serif,system-ui,-apple-system,BlinkMacSystemFont,Segoe UI,Roboto,Helvetica Neue,Arial,Noto Sans,sans-serif,"Apple Color Emoji","Segoe UI Emoji",Segoe UI Symbol,"Noto Color Emoji";font-feature-settings:normal;font-variation-settings:normal}body{margin:0;line-height:inherit}hr{height:0;color:inherit;border-top-width:1px}abbr:where([title]){-webkit-text-decoration:underline dotted;text-decoration:underline dotted}h1,h2,h3,h4,h5,h6{font-size:inherit;font-weight:inherit}a{color:inherit;text-decoration:inherit}b,strong{font-weight:bolder}code,kbd,samp,pre{font-family:ui-monospace,SFMono-Regular,Menlo,Monaco,Consolas,Liberation Mono,Courier New,monospace;font-size:1em}small{font-size:80%}sub,sup{font-size:75%;line-height:0;position:relative;vertical-align:baseline}sub{bottom:-.25em}sup{top:-.5em}table{text-indent:0;border-color:inherit;border-collapse:collapse}button,input,optgroup,select,textarea{font-family:inherit;font-feature-settings:inherit;font-variation-settings:inherit;font-size:100%;font-weight:inherit;line-height:inherit;color:inherit;margin:0;padding:0}button,select{text-transform:none}button,[type=button],[type=reset],[type=submit]{-webkit-appearance:button;background-color:transparent;background-image:none}:-moz-focusring{outline:auto}:-moz-ui-invalid{box-shadow:none}progress{vertical-align:baseline}::-webkit-inner-spin-button,::-webkit-outer-spin-button{height:auto}[type=search]{-webkit-appearance:textfield;outline-offset:-2px}::-webkit-search-decoration{-webkit-appearance:none}::-webkit-file-upload-button{-webkit-appearance:button;font:inherit}summary{display:list-item}blockquote,dl,dd,h1,h2,h3,h4,h5,h6,hr,figure,p,pre{margin:0}fieldset{margin:0;padding:0}legend{padding:0}ol,ul,menu{list-style:none;margin:0;padding:0}dialog{padding:0}textarea{resize:vertical}input::-moz-placeholder,textarea::-moz-placeholder{opacity:1;color:#9ca3af}input::placeholder,textarea::placeholder{opacity:1;color:#9ca3af}button,[role=button]{cursor:pointer}:disabled{cursor:default}img,svg,video,canvas,audio,iframe,embed,object{display:block;vertical-align:middle}img,video{max-width:100%;height:auto}[hidden]{display:none}*,:before,:after{--tw-border-spacing-x: 0;--tw-border-spacing-y: 0;--tw-translate-x: 0;--tw-translate-y: 0;--tw-rotate: 0;--tw-skew-x: 0;--tw-skew-y: 0;--tw-scale-x: 1;--tw-scale-y: 1;--tw-pan-x: ;--tw-pan-y: ;--tw-pinch-zoom: ;--tw-scroll-snap-strictness: proximity;--tw-gradient-from-position: ;--tw-gradient-via-position: ;--tw-gradient-to-position: ;--tw-ordinal: ;--tw-slashed-zero: ;--tw-numeric-figure: ;--tw-numeric-spacing: ;--tw-numeric-fraction: ;--tw-ring-inset: ;--tw-ring-offset-width: 0px;--tw-ring-offset-color: #fff;--tw-ring-color: rgb(59 130 246 / .5);--tw-ring-offset-shadow: 0 0 #0000;--tw-ring-shadow: 0 0 #0000;--tw-shadow: 0 0 #0000;--tw-shadow-colored: 0 0 #0000;--tw-blur: ;--tw-brightness: ;--tw-contrast: ;--tw-grayscale: ;--tw-hue-rotate: ;--tw-invert: ;--tw-saturate: ;--tw-sepia: ;--tw-drop-shadow: ;--tw-backdrop-blur: ;--tw-backdrop-brightness: ;--tw-backdrop-contrast: ;--tw-backdrop-grayscale: ;--tw-backdrop-hue-rotate: ;--tw-backdrop-invert: ;--tw-backdrop-opacity: ;--tw-backdrop-saturate: ;--tw-backdrop-sepia: }::backdrop{--tw-border-spacing-x: 0;--tw-border-spacing-y: 0;--tw-translate-x: 0;--tw-translate-y: 0;--tw-rotate: 0;--tw-skew-x: 0;--tw-skew-y: 0;--tw-scale-x: 1;--tw-scale-y: 1;--tw-pan-x: ;--tw-pan-y: ;--tw-pinch-zoom: ;--tw-scroll-snap-strictness: proximity;--tw-gradient-from-position: ;--tw-gradient-via-position: ;--tw-gradient-to-position: ;--tw-ordinal: ;--tw-slashed-zero: ;--tw-numeric-figure: ;--tw-numeric-spacing: ;--tw-numeric-fraction: ;--tw-ring-inset: ;--tw-ring-offset-width: 0px;--tw-ring-offset-color: #fff;--tw-ring-color: rgb(59 130 246 / .5);--tw-ring-offset-shadow: 0 0 #0000;--tw-ring-shadow: 0 0 #0000;--tw-shadow: 0 0 #0000;--tw-shadow-colored: 0 0 #0000;--tw-blur: ;--tw-brightness: ;--tw-contrast: ;--tw-grayscale: ;--tw-hue-rotate: ;--tw-invert: ;--tw-saturate: ;--tw-sepia: ;--tw-drop-shadow: ;--tw-backdrop-blur: ;--tw-backdrop-brightness: ;--tw-backdrop-contrast: ;--tw-backdrop-grayscale: ;--tw-backdrop-hue-rotate: ;--tw-backdrop-invert: ;--tw-backdrop-opacity: ;--tw-backdrop-saturate: ;--tw-backdrop-sepia: }.visible{visibility:visible}.fixed{position:fixed}.absolute{position:absolute}.relative{position:relative}.bottom-4{bottom:1rem}.left-1\\/2{left:50%}.left-4{left:1rem}.right-4{right:1rem}.z-\\[999999999999\\]{z-index:999999999999}.mr-3{margin-right:.75rem}.flex{display:flex}.hidden{display:none}.h-16{height:4rem}.h-7{height:1.75rem}.w-7{width:1.75rem}.w-full{width:100%}.origin-center{transform-origin:center}.-translate-x-1\\/2{--tw-translate-x: -50%;transform:translate(var(--tw-translate-x),var(--tw-translate-y)) rotate(var(--tw-rotate)) skew(var(--tw-skew-x)) skewY(var(--tw-skew-y)) scaleX(var(--tw-scale-x)) scaleY(var(--tw-scale-y))}.transform{transform:translate(var(--tw-translate-x),var(--tw-translate-y)) rotate(var(--tw-rotate)) skew(var(--tw-skew-x)) skewY(var(--tw-skew-y)) scaleX(var(--tw-scale-x)) scaleY(var(--tw-scale-y))}.cursor-pointer{cursor:pointer}.items-center{align-items:center}.justify-center{justify-content:center}.rounded-full{border-radius:9999px}.bg-brand{--tw-bg-opacity: 1;background-color:rgb(var(--color-brand) / var(--tw-bg-opacity))}.bg-red-50{--tw-bg-opacity: 1;background-color:rgb(254 242 242 / var(--tw-bg-opacity))}.px-6{padding-left:1.5rem;padding-right:1.5rem}.py-4{padding-top:1rem;padding-bottom:1rem}.text-base{font-size:1rem;line-height:1.5rem}.font-semibold{font-weight:600}.leading-5{line-height:1.25rem}.antialiased{-webkit-font-smoothing:antialiased;-moz-osx-font-smoothing:grayscale}.outline-none{outline:2px solid transparent;outline-offset:2px}.drop-shadow-md{--tw-drop-shadow: drop-shadow(0 4px 3px rgb(0 0 0 / .07)) drop-shadow(0 2px 2px rgb(0 0 0 / .06));filter:var(--tw-blur) var(--tw-brightness) var(--tw-contrast) var(--tw-grayscale) var(--tw-hue-rotate) var(--tw-invert) var(--tw-saturate) var(--tw-sepia) var(--tw-drop-shadow)}.transition{transition-property:color,background-color,border-color,text-decoration-color,fill,stroke,opacity,box-shadow,transform,filter,-webkit-backdrop-filter;transition-property:color,background-color,border-color,text-decoration-color,fill,stroke,opacity,box-shadow,transform,filter,backdrop-filter;transition-property:color,background-color,border-color,text-decoration-color,fill,stroke,opacity,box-shadow,transform,filter,backdrop-filter,-webkit-backdrop-filter;transition-timing-function:cubic-bezier(.4,0,.2,1);transition-duration:.15s}@font-face{font-family:Inter var;src:url(https://rsms.me/inter/inter.css)}h1,h2,h3,h4,h5,h6{font-family:Inter var;font-weight:400;letter-spacing:normal}html,body,:host{font-family:ui-sans-serif,system-ui,-apple-system,BlinkMacSystemFont,Segoe UI,Roboto,Helvetica Neue,Arial,Noto Sans,sans-serif,Apple Color Emoji,Segoe UI Emoji,Segoe UI Symbol,Noto Color Emoji}.focus\\:outline-none:focus{outline:2px solid transparent;outline-offset:2px}.focus\\:ring-4:focus{--tw-ring-offset-shadow: var(--tw-ring-inset) 0 0 0 var(--tw-ring-offset-width) var(--tw-ring-offset-color);--tw-ring-shadow: var(--tw-ring-inset) 0 0 0 calc(4px + var(--tw-ring-offset-width)) var(--tw-ring-color);box-shadow:var(--tw-ring-offset-shadow),var(--tw-ring-shadow),var(--tw-shadow, 0 0 #0000)}.focus\\:ring-gray-600:focus{--tw-ring-opacity: 1;--tw-ring-color: rgb(75 85 99 / var(--tw-ring-opacity))}.focus\\:ring-opacity-50:focus{--tw-ring-opacity: .5}.active\\:scale-95:active{--tw-scale-x: .95;--tw-scale-y: .95;transform:translate(var(--tw-translate-x),var(--tw-translate-y)) rotate(var(--tw-rotate)) skew(var(--tw-skew-x)) skewY(var(--tw-skew-y)) scaleX(var(--tw-scale-x)) scaleY(var(--tw-scale-y))}@media (min-width: 768px){.md\\:bottom-6{bottom:1.5rem}.md\\:left-10{left:2.5rem}.md\\:right-10{right:2.5rem}}
`,O="https://arrows-marcelo.sa.ngrok.io/plans";customElements.define("arrows-modal-box",g);customElements.define("arrows-floating-button",m);customElements.define("arrows-inline",H);const c=window.Arrows;if(!c||!c.q)throw new Error("Arrows is not defined. This shouldn't happen");c.fingerprint="";c.__css=$;document.head.appendChild(document.createElement("style")).innerHTML=_;function y(...a){console.log(...a)}function u(a,t){function r(o,i){return typeof i=="string"?typeof o==i:o instanceof i}function e(o){return typeof o>"u"}if(t.required&&e(a))throw new Error("Argument is required");for(const[o,i]of Object.entries(t.props||{})){if(i.required&&e(a[o]))throw new Error(`"${o}" is required`);let s=!0;if(i.type&&!e(a[o])&&(i.type instanceof Array?i.type.forEach(n=>{s=s||r(a[o],n)}):s=r(a[o],i.type)),!s)throw new Error(`"${o}" is of wrong type.Expected type "${i.type}"`)}}function A(a){const t=getComputedStyle(a).colorScheme;return t==="dark"||t==="light"?t:null}function v(a,t){if(!a["ui.color-scheme"]){const r=A(t);r&&(a["ui.color-scheme"]=r)}return a}class f{constructor(t,r){this.iframeDoQueue=[],this.__config={arrowsOrigin:O},this.api=new M(this),this.namespace=t,this.actionManager=new S(t),f.actionsManagers=f.actionsManagers||{},f.actionsManagers[t]=this.actionManager,this.processQueue(r),this.actionManager.on("__dimensionChanged",e=>{const{data:o}=e.detail,i=this.iframe;if(!i)return;const s="px";o.iframeHeight&&(i.style.height=o.iframeHeight+s),this.modalBox&&(i.style.maxHeight=window.innerHeight-100+"px")}),this.actionManager.on("__iframeReady",()=>{this.iframeReady=!0,this.iframe&&(this.iframe.style.visibility=""),this.doInIframe({method:"parentKnowsIframeReady"}),this.iframeDoQueue.forEach(e=>{this.doInIframe(e)})}),this.actionManager.on("__routeChanged",()=>{const{top:e,height:o}=this.inlineEl.getBoundingClientRect();e<0&&Math.abs(e/o)>=.25&&this.inlineEl.scrollIntoView({behavior:"smooth"})}),this.actionManager.on("linkReady",()=>{var e,o;(e=this.modalBox)==null||e.setAttribute("state","loaded"),(o=this.inlineEl)==null||o.setAttribute("loading","done")}),this.actionManager.on("linkFailed",e=>{var i,s,n,d;this.iframe&&((i=this.inlineEl)==null||i.setAttribute("data-error-code",e.detail.data.code),(s=this.modalBox)==null||s.setAttribute("data-error-code",e.detail.data.code),(n=this.inlineEl)==null||n.setAttribute("loading","failed"),(d=this.modalBox)==null||d.setAttribute("state","failed"))})}static getQueryObject(t){return t=t||{},{...t,guest:t.guests??void 0}}processInstruction(t){const r=[].slice.call(t);if(typeof r[0]!="string"){r.forEach(i=>{this.processInstruction(i)});return}const[e,...o]=r;this.api[e]||y(`Instruction ${e} not FOUND`);try{this.api[e](...o)}catch(i){y("Instruction couldn't be executed",i)}return r}processQueue(t){t.forEach(r=>{this.processInstruction(r)}),t.splice(0),t.push=r=>{this.processInstruction(r)}}createIframe({arrowsLink:t,queryObject:r={},arrowsOrigin:e}){const o=this.iframe=document.createElement("iframe");o.className="arrows-embed",o.name=`arrows-embed=${this.namespace}`;const i=this.getConfig(),{iframeAttrs:s,...n}=r;s&&s.id&&o.setAttribute("id",s.id);const d=new URLSearchParams;for(const[w,l]of Object.entries(n))l!==void 0&&(l instanceof Array?l.forEach(p=>d.append(w,p)):d.set(w,l));const h=new URL(`${e||i.arrowsOrigin}/${t}`);h.searchParams.set("embed",this.namespace),i.debug&&h.searchParams.set("debug",""+i.debug),o.style.visibility="hidden",i.uiDebug&&(o.style.border="1px solid green");for(const[w,l]of d)h.searchParams.append(w,l);return o.src=h.toString(),o}getConfig(){return this.__config}doInIframe(t){if(!this.iframeReady){this.iframeDoQueue.push(t);return}if(!this.iframe)throw new Error("iframe doesn't exist. `createIframe` must be called before `doInIframe`");this.iframe.contentWindow&&this.iframe.contentWindow.postMessage({originator:"ARROWS",method:t.method,arg:t.arg},"*")}}const C=class R{constructor(t){this.arrows=t}init(t,r={}){typeof t!="string"&&(r=t||{}),R.initializedNamespaces.push(this.arrows.namespace);const{arrowsOrigin:e,origin:o,...i}=r;this.arrows.__config.arrowsOrigin=e||o||this.arrows.__config.arrowsOrigin,this.arrows.__config={...this.arrows.__config,...i}}inline({arrowsLink:t,elementOrSelector:r,config:e}){if(u(arguments[0],{required:!0,props:{arrowsLink:{required:!0,type:"string"},elementOrSelector:{required:!0,type:["string",HTMLElement]},config:{required:!1,type:Object}}}),e=e||{},typeof e.iframeAttrs=="string"||e.iframeAttrs instanceof Array)throw new Error("iframeAttrs should be an object");const o=r instanceof HTMLElement?r:document.querySelector(r);if(!o)throw new Error("Element not found");e.embedType="inline";const i=this.arrows.createIframe({arrowsLink:t,queryObject:v(f.getQueryObject(e),o)});i.style.height="100%",i.style.width="100%",o.classList.add("arrows-inline-container");const s=document.createElement("template");s.innerHTML='<arrows-inline style="max-height:inherit;height:inherit;min-height:inherit;display:flex;position:relative;flex-wrap:wrap;width:100%"></arrows-inline><style>.arrows-inline-container::-webkit-scrollbar{display:none}.arrows-inline-container{scrollbar-width:none}</style>',this.arrows.inlineEl=s.content.children[0],this.arrows.inlineEl.appendChild(i),o.appendChild(s.content)}floatingButton({arrowsLink:t,buttonText:r="Arrows Plan",hideButtonIcon:e=!1,attributes:o,buttonPosition:i="bottom-right",buttonColor:s="rgb(0, 0, 0)",buttonTextColor:n="rgb(255, 255, 255)",arrowsOrigin:d,config:h}){let w=null;o!=null&&o.id&&(w=document.getElementById(o.id));let l;w?l=w:(l=document.createElement("arrows-floating-button"),l.dataset.arrowsLink=t,l.dataset.arrowsNamespace=this.arrows.namespace,l.dataset.arrowsOrigin=d??"",h&&(l.dataset.arrowsConfig=JSON.stringify(h)),o!=null&&o.id&&(l.id=o.id),document.body.appendChild(l));const p=l.dataset;p.buttonText=r,p.hideButtonIcon=""+e,p.buttonPosition=""+i,p.buttonColor=""+s,p.buttonTextColor=""+n}modal({arrowsLink:t,config:r={},uid:e}){e=e||0;const o=document.querySelector(`arrows-modal-box[uid="${e}"]`);if(o){o.setAttribute("state","started");return}if(typeof r.iframeAttrs=="string"||r.iframeAttrs instanceof Array)throw new Error("iframeAttrs should be an object");r.embedType="modal";const i=document.body,s=this.arrows.createIframe({arrowsLink:t,queryObject:v(f.getQueryObject(r),i)});s.style.borderRadius="8px",s.style.height="100%",s.style.width="100%";const n=document.createElement("template");n.innerHTML=`<arrows-modal-box uid="${e}"></arrows-modal-box>`,this.arrows.modalBox=n.content.children[0],this.arrows.modalBox.appendChild(s),this.handleClose(),i.appendChild(n.content)}handleClose(){this.arrows.actionManager.on("__closeIframe",()=>{this.arrows.modalBox.setAttribute("state","closed")})}on({action:t,callback:r}){u(arguments[0],{required:!0,props:{action:{required:!0,type:"string"},callback:{required:!0,type:Function}}}),this.arrows.actionManager.on(t,r)}off({action:t,callback:r}){this.arrows.actionManager.off(t,r)}preload({arrowsLink:t}){u(arguments[0],{required:!0,props:{arrowsLink:{type:"string",required:!0}}});const r=document.body.appendChild(document.createElement("iframe")),e=this.arrows.getConfig(),o=new URL(`${e.arrowsOrigin}/${t}`);o.searchParams.set("prerender","true"),r.src=o.toString(),r.style.width="0",r.style.height="0",r.style.display="none"}ui(t){u(t,{required:!0,props:{theme:{required:!1,type:"string"},styles:{required:!1,type:Object}}}),this.arrows.doInIframe({method:"ui",arg:t})}};C.initializedNamespaces=[];let M=C;const I="";c.instance=new f(I,c.q);for(const[a,t]of Object.entries(c.ns))t.instance=new f(a,t.q);window.addEventListener("message",a=>{const t=a.data,r=t.fullType,e=S.parseAction(r);if(!e)return;const o=f.actionsManagers[e.ns];if(c.__logQueue=c.__logQueue||[],c.__logQueue.push({...e,data:t.data}),!o)throw new Error("Unhandled Action"+e);o.fire(e.type,t.data)});document.addEventListener("click",a=>{const t=a.target;if(!(t instanceof HTMLElement))return;const r=t.dataset.arrowsLink;if(!r)return;const e=t.dataset.uniqueId=t.dataset.uniqueId||String(Date.now()),o=t.dataset.arrowsNamespace,i=t.dataset.arrowsConfig||"",s=t.dataset.arrowsOrigin||"";let n;try{n=JSON.parse(i)}catch{n={}}let d=c;if(o&&(d=c.ns[o]),!d)throw new Error(`Namespace ${o} isn't defined`);d("modal",{arrowsLink:r,config:n,uid:e,arrowsOrigin:s})});let x=null;(function(){setInterval(()=>{const t=A(document.body);t&&t!==x&&(x=t,M.initializedNamespaces.forEach(r=>{T(r)("ui",{colorScheme:t})}))},50)})();function T(a){let t;return a===I?t=c:t=c.ns[a],t}
`;class g extends HTMLElement{static get observedAttributes(){return["state"]}assertHasShadowRoot(){if(!this.shadowRoot)throw new Error("No shadow root")}show(t){this.assertHasShadowRoot(),this.shadowRoot.host.style.visibility=t?"visible":"hidden",t||(document.body.style.overflow=g.htmlOverflow)}open(){this.show(!0);const t=new Event("open");this.dispatchEvent(t)}close(){this.show(!1);const t=new Event("close");this.dispatchEvent(t)}getLoaderElement(){this.assertHasShadowRoot();const t=this.shadowRoot.querySelector(".loader");if(!t)throw new Error("No loader element");return t}getErrorElement(){this.assertHasShadowRoot();const t=this.shadowRoot.querySelector("#error");if(!t)throw new Error("No error element");return t}attributeChangedCallback(t,r,o){if(t==="state"){if(o=="loaded")this.getLoaderElement().style.display="none";else if(o==="started")this.open();else if(o=="closed")this.close();else if(o==="failed"){this.getLoaderElement().style.display="none",this.getErrorElement().style.display="inline-block";const e=E(this.dataset.errorCode);this.getErrorElement().innerText=e}}}connectedCallback(){this.assertHasShadowRoot();const t=this.shadowRoot.querySelector(".close");document.addEventListener("keydown",r=>{r.key==="Escape"&&this.close()},{once:!0}),this.shadowRoot.host.addEventListener("click",()=>{this.close()}),t&&(t.onclick=()=>{this.close()})}constructor(){super();const t=`<style>${window.Arrows.__css}</style><style>${k}</style>${q}`;this.attachShadow({mode:"open"}),g.htmlOverflow=document.body.style.overflow,document.body.style.overflow="hidden",this.open(),this.assertHasShadowRoot(),this.shadowRoot.innerHTML=t}}const _=`.arrows-embed{border:0px;min-height:300px;margin:0 auto;width:100%}
`,T=`*,:before,:after{box-sizing:border-box;border-width:0;border-style:solid;border-color:#e5e7eb}:before,:after{--tw-content: ""}html{line-height:1.5;-webkit-text-size-adjust:100%;-moz-tab-size:4;-o-tab-size:4;tab-size:4;font-family:Inter var,ui-sans-serif,system-ui,-apple-system,BlinkMacSystemFont,Segoe UI,Roboto,Helvetica Neue,Arial,Noto Sans,sans-serif,"Apple Color Emoji","Segoe UI Emoji",Segoe UI Symbol,"Noto Color Emoji";font-feature-settings:normal;font-variation-settings:normal}body{margin:0;line-height:inherit}hr{height:0;color:inherit;border-top-width:1px}abbr:where([title]){-webkit-text-decoration:underline dotted;text-decoration:underline dotted}h1,h2,h3,h4,h5,h6{font-size:inherit;font-weight:inherit}a{color:inherit;text-decoration:inherit}b,strong{font-weight:bolder}code,kbd,samp,pre{font-family:ui-monospace,SFMono-Regular,Menlo,Monaco,Consolas,Liberation Mono,Courier New,monospace;font-size:1em}small{font-size:80%}sub,sup{font-size:75%;line-height:0;position:relative;vertical-align:baseline}sub{bottom:-.25em}sup{top:-.5em}table{text-indent:0;border-color:inherit;border-collapse:collapse}button,input,optgroup,select,textarea{font-family:inherit;font-feature-settings:inherit;font-variation-settings:inherit;font-size:100%;font-weight:inherit;line-height:inherit;color:inherit;margin:0;padding:0}button,select{text-transform:none}button,[type=button],[type=reset],[type=submit]{-webkit-appearance:button;background-color:transparent;background-image:none}:-moz-focusring{outline:auto}:-moz-ui-invalid{box-shadow:none}progress{vertical-align:baseline}::-webkit-inner-spin-button,::-webkit-outer-spin-button{height:auto}[type=search]{-webkit-appearance:textfield;outline-offset:-2px}::-webkit-search-decoration{-webkit-appearance:none}::-webkit-file-upload-button{-webkit-appearance:button;font:inherit}summary{display:list-item}blockquote,dl,dd,h1,h2,h3,h4,h5,h6,hr,figure,p,pre{margin:0}fieldset{margin:0;padding:0}legend{padding:0}ol,ul,menu{list-style:none;margin:0;padding:0}dialog{padding:0}textarea{resize:vertical}input::-moz-placeholder,textarea::-moz-placeholder{opacity:1;color:#9ca3af}input::placeholder,textarea::placeholder{opacity:1;color:#9ca3af}button,[role=button]{cursor:pointer}:disabled{cursor:default}img,svg,video,canvas,audio,iframe,embed,object{display:block;vertical-align:middle}img,video{max-width:100%;height:auto}[hidden]{display:none}*,:before,:after{--tw-border-spacing-x: 0;--tw-border-spacing-y: 0;--tw-translate-x: 0;--tw-translate-y: 0;--tw-rotate: 0;--tw-skew-x: 0;--tw-skew-y: 0;--tw-scale-x: 1;--tw-scale-y: 1;--tw-pan-x: ;--tw-pan-y: ;--tw-pinch-zoom: ;--tw-scroll-snap-strictness: proximity;--tw-gradient-from-position: ;--tw-gradient-via-position: ;--tw-gradient-to-position: ;--tw-ordinal: ;--tw-slashed-zero: ;--tw-numeric-figure: ;--tw-numeric-spacing: ;--tw-numeric-fraction: ;--tw-ring-inset: ;--tw-ring-offset-width: 0px;--tw-ring-offset-color: #fff;--tw-ring-color: rgb(59 130 246 / .5);--tw-ring-offset-shadow: 0 0 #0000;--tw-ring-shadow: 0 0 #0000;--tw-shadow: 0 0 #0000;--tw-shadow-colored: 0 0 #0000;--tw-blur: ;--tw-brightness: ;--tw-contrast: ;--tw-grayscale: ;--tw-hue-rotate: ;--tw-invert: ;--tw-saturate: ;--tw-sepia: ;--tw-drop-shadow: ;--tw-backdrop-blur: ;--tw-backdrop-brightness: ;--tw-backdrop-contrast: ;--tw-backdrop-grayscale: ;--tw-backdrop-hue-rotate: ;--tw-backdrop-invert: ;--tw-backdrop-opacity: ;--tw-backdrop-saturate: ;--tw-backdrop-sepia: }::backdrop{--tw-border-spacing-x: 0;--tw-border-spacing-y: 0;--tw-translate-x: 0;--tw-translate-y: 0;--tw-rotate: 0;--tw-skew-x: 0;--tw-skew-y: 0;--tw-scale-x: 1;--tw-scale-y: 1;--tw-pan-x: ;--tw-pan-y: ;--tw-pinch-zoom: ;--tw-scroll-snap-strictness: proximity;--tw-gradient-from-position: ;--tw-gradient-via-position: ;--tw-gradient-to-position: ;--tw-ordinal: ;--tw-slashed-zero: ;--tw-numeric-figure: ;--tw-numeric-spacing: ;--tw-numeric-fraction: ;--tw-ring-inset: ;--tw-ring-offset-width: 0px;--tw-ring-offset-color: #fff;--tw-ring-color: rgb(59 130 246 / .5);--tw-ring-offset-shadow: 0 0 #0000;--tw-ring-shadow: 0 0 #0000;--tw-shadow: 0 0 #0000;--tw-shadow-colored: 0 0 #0000;--tw-blur: ;--tw-brightness: ;--tw-contrast: ;--tw-grayscale: ;--tw-hue-rotate: ;--tw-invert: ;--tw-saturate: ;--tw-sepia: ;--tw-drop-shadow: ;--tw-backdrop-blur: ;--tw-backdrop-brightness: ;--tw-backdrop-contrast: ;--tw-backdrop-grayscale: ;--tw-backdrop-hue-rotate: ;--tw-backdrop-invert: ;--tw-backdrop-opacity: ;--tw-backdrop-saturate: ;--tw-backdrop-sepia: }.visible{visibility:visible}.fixed{position:fixed}.absolute{position:absolute}.relative{position:relative}.bottom-4{bottom:1rem}.left-1\\/2{left:50%}.left-4{left:1rem}.right-4{right:1rem}.z-\\[999999999999\\]{z-index:999999999999}.mr-3{margin-right:.75rem}.flex{display:flex}.hidden{display:none}.h-16{height:4rem}.h-7{height:1.75rem}.w-7{width:1.75rem}.w-full{width:100%}.origin-center{transform-origin:center}.-translate-x-1\\/2{--tw-translate-x: -50%;transform:translate(var(--tw-translate-x),var(--tw-translate-y)) rotate(var(--tw-rotate)) skew(var(--tw-skew-x)) skewY(var(--tw-skew-y)) scaleX(var(--tw-scale-x)) scaleY(var(--tw-scale-y))}.transform{transform:translate(var(--tw-translate-x),var(--tw-translate-y)) rotate(var(--tw-rotate)) skew(var(--tw-skew-x)) skewY(var(--tw-skew-y)) scaleX(var(--tw-scale-x)) scaleY(var(--tw-scale-y))}.cursor-pointer{cursor:pointer}.items-center{align-items:center}.justify-center{justify-content:center}.rounded-full{border-radius:9999px}.bg-brand{--tw-bg-opacity: 1;background-color:rgb(var(--color-brand) / var(--tw-bg-opacity))}.bg-red-50{--tw-bg-opacity: 1;background-color:rgb(254 242 242 / var(--tw-bg-opacity))}.px-6{padding-left:1.5rem;padding-right:1.5rem}.py-4{padding-top:1rem;padding-bottom:1rem}.text-base{font-size:1rem;line-height:1.5rem}.font-semibold{font-weight:600}.leading-5{line-height:1.25rem}.antialiased{-webkit-font-smoothing:antialiased;-moz-osx-font-smoothing:grayscale}.outline-none{outline:2px solid transparent;outline-offset:2px}.drop-shadow-md{--tw-drop-shadow: drop-shadow(0 4px 3px rgb(0 0 0 / .07)) drop-shadow(0 2px 2px rgb(0 0 0 / .06));filter:var(--tw-blur) var(--tw-brightness) var(--tw-contrast) var(--tw-grayscale) var(--tw-hue-rotate) var(--tw-invert) var(--tw-saturate) var(--tw-sepia) var(--tw-drop-shadow)}.transition{transition-property:color,background-color,border-color,text-decoration-color,fill,stroke,opacity,box-shadow,transform,filter,-webkit-backdrop-filter;transition-property:color,background-color,border-color,text-decoration-color,fill,stroke,opacity,box-shadow,transform,filter,backdrop-filter;transition-property:color,background-color,border-color,text-decoration-color,fill,stroke,opacity,box-shadow,transform,filter,backdrop-filter,-webkit-backdrop-filter;transition-timing-function:cubic-bezier(.4,0,.2,1);transition-duration:.15s}@font-face{font-family:Inter var;src:url(https://rsms.me/inter/inter.css)}h1,h2,h3,h4,h5,h6{font-family:Inter var;font-weight:400;letter-spacing:normal}html,body,:host{font-family:ui-sans-serif,system-ui,-apple-system,BlinkMacSystemFont,Segoe UI,Roboto,Helvetica Neue,Arial,Noto Sans,sans-serif,Apple Color Emoji,Segoe UI Emoji,Segoe UI Symbol,Noto Color Emoji}.focus\\:outline-none:focus{outline:2px solid transparent;outline-offset:2px}.focus\\:ring-4:focus{--tw-ring-offset-shadow: var(--tw-ring-inset) 0 0 0 var(--tw-ring-offset-width) var(--tw-ring-offset-color);--tw-ring-shadow: var(--tw-ring-inset) 0 0 0 calc(4px + var(--tw-ring-offset-width)) var(--tw-ring-color);box-shadow:var(--tw-ring-offset-shadow),var(--tw-ring-shadow),var(--tw-shadow, 0 0 #0000)}.focus\\:ring-gray-600:focus{--tw-ring-opacity: 1;--tw-ring-color: rgb(75 85 99 / var(--tw-ring-opacity))}.focus\\:ring-opacity-50:focus{--tw-ring-opacity: .5}.active\\:scale-95:active{--tw-scale-x: .95;--tw-scale-y: .95;transform:translate(var(--tw-translate-x),var(--tw-translate-y)) rotate(var(--tw-rotate)) skew(var(--tw-skew-x)) skewY(var(--tw-skew-y)) scaleX(var(--tw-scale-x)) scaleY(var(--tw-scale-y))}@media (min-width: 768px){.md\\:bottom-6{bottom:1.5rem}.md\\:left-10{left:2.5rem}.md\\:right-10{right:2.5rem}}
`,$="https://arrows-marcelo.sa.ngrok.io/plans";customElements.define("arrows-modal-box",g);customElements.define("arrows-floating-button",m);customElements.define("arrows-inline",H);const c=window.Arrows;if(!c||!c.q)throw new Error("Arrows is not defined. This shouldn't happen");c.fingerprint="";c.__css=T;document.head.appendChild(document.createElement("style")).innerHTML=_;function b(...s){console.log(...s)}function u(s,t){function r(e,i){return typeof i=="string"?typeof e==i:e instanceof i}function o(e){return typeof e>"u"}if(t.required&&o(s))throw new Error("Argument is required");for(const[e,i]of Object.entries(t.props||{})){if(i.required&&o(s[e]))throw new Error(`"${e}" is required`);let a=!0;if(i.type&&!o(s[e])&&(i.type instanceof Array?i.type.forEach(n=>{a=a||r(s[e],n)}):a=r(s[e],i.type)),!a)throw new Error(`"${e}" is of wrong type.Expected type "${i.type}"`)}}function S(s){const t=getComputedStyle(s).colorScheme;return t==="dark"||t==="light"?t:null}function y(s,t){if(!s["ui.color-scheme"]){const r=S(t);r&&(s["ui.color-scheme"]=r)}return s}class f{constructor(t,r){this.iframeDoQueue=[],this.__config={arrowsOrigin:$},this.api=new R(this),this.namespace=t,this.actionManager=new x(t),f.actionsManagers=f.actionsManagers||{},f.actionsManagers[t]=this.actionManager,this.processQueue(r),this.actionManager.on("__dimensionChanged",o=>{const{data:e}=o.detail,i=this.iframe;if(!i)return;const a="px";e.iframeHeight&&(i.style.height=e.iframeHeight+a),this.modalBox&&(i.style.maxHeight=window.innerHeight-100+"px")}),this.actionManager.on("__iframeReady",()=>{this.iframeReady=!0,this.iframe&&(this.iframe.style.visibility=""),this.doInIframe({method:"parentKnowsIframeReady"}),this.iframeDoQueue.forEach(o=>{this.doInIframe(o)})}),this.actionManager.on("__routeChanged",()=>{const{top:o,height:e}=this.inlineEl.getBoundingClientRect();o<0&&Math.abs(o/e)>=.25&&this.inlineEl.scrollIntoView({behavior:"smooth"})}),this.actionManager.on("linkReady",()=>{var o,e;(o=this.modalBox)==null||o.setAttribute("state","loaded"),(e=this.inlineEl)==null||e.setAttribute("loading","done")}),this.actionManager.on("linkFailed",o=>{var i,a,n,d;this.iframe&&((i=this.inlineEl)==null||i.setAttribute("data-error-code",o.detail.data.code),(a=this.modalBox)==null||a.setAttribute("data-error-code",o.detail.data.code),(n=this.inlineEl)==null||n.setAttribute("loading","failed"),(d=this.modalBox)==null||d.setAttribute("state","failed"))})}static getQueryObject(t){return t=t||{},{...t,guest:t.guests??void 0}}processInstruction(t){const r=[].slice.call(t);if(typeof r[0]!="string"){r.forEach(i=>{this.processInstruction(i)});return}const[o,...e]=r;this.api[o]||b(`Instruction ${o} not FOUND`);try{this.api[o](...e)}catch(i){b("Instruction couldn't be executed",i)}return r}processQueue(t){t.forEach(r=>{this.processInstruction(r)}),t.splice(0),t.push=r=>{this.processInstruction(r)}}createIframe({arrowsLink:t,queryObject:r={},arrowsOrigin:o}){const e=this.iframe=document.createElement("iframe");e.className="arrows-embed",e.name=`arrows-embed=${this.namespace}`;const i=this.getConfig(),{iframeAttrs:a,...n}=r;a&&a.id&&e.setAttribute("id",a.id);const d=new URLSearchParams;for(const[w,l]of Object.entries(n))l!==void 0&&(l instanceof Array?l.forEach(p=>d.append(w,p)):d.set(w,l));const h=new URL(`${o||i.arrowsOrigin}/${t}`);h.searchParams.set("embed",this.namespace),i.debug&&h.searchParams.set("debug",""+i.debug),e.style.visibility="hidden",i.uiDebug&&(e.style.border="1px solid green");for(const[w,l]of d)h.searchParams.append(w,l);return e.src=h.toString(),e}getConfig(){return this.__config}doInIframe(t){if(!this.iframeReady){this.iframeDoQueue.push(t);return}if(!this.iframe)throw new Error("iframe doesn't exist. `createIframe` must be called before `doInIframe`");this.iframe.contentWindow&&this.iframe.contentWindow.postMessage({originator:"ARROWS",method:t.method,arg:t.arg},"*")}}const C=class A{constructor(t){this.arrows=t}init(t,r={}){typeof t!="string"&&(r=t||{}),A.initializedNamespaces.push(this.arrows.namespace);const{arrowsOrigin:o,origin:e,...i}=r;this.arrows.__config.arrowsOrigin=o||e||this.arrows.__config.arrowsOrigin,this.arrows.__config={...this.arrows.__config,...i}}inline({arrowsLink:t,elementOrSelector:r,config:o}){if(u(arguments[0],{required:!0,props:{arrowsLink:{required:!0,type:"string"},elementOrSelector:{required:!0,type:["string",HTMLElement]},config:{required:!1,type:Object}}}),o=o||{},typeof o.iframeAttrs=="string"||o.iframeAttrs instanceof Array)throw new Error("iframeAttrs should be an object");const e=r instanceof HTMLElement?r:document.querySelector(r);if(!e)throw new Error("Element not found");o.embedType="inline";const i=this.arrows.createIframe({arrowsLink:t,queryObject:y(f.getQueryObject(o),e)});i.style.height="100%",i.style.width="100%",e.classList.add("arrows-inline-container");const a=document.createElement("template");a.innerHTML='<arrows-inline style="max-height:inherit;height:inherit;min-height:inherit;display:flex;position:relative;flex-wrap:wrap;width:100%"></arrows-inline><style>.arrows-inline-container::-webkit-scrollbar{display:none}.arrows-inline-container{scrollbar-width:none}</style>',this.arrows.inlineEl=a.content.children[0],this.arrows.inlineEl.appendChild(i),e.appendChild(a.content)}floatingButton({arrowsLink:t,buttonText:r="Arrows Plan",hideButtonIcon:o=!1,attributes:e,buttonPosition:i="bottom-right",buttonColor:a="rgb(0, 0, 0)",buttonTextColor:n="rgb(255, 255, 255)",arrowsOrigin:d,config:h}){let w=null;e!=null&&e.id&&(w=document.getElementById(e.id));let l;w?l=w:(l=document.createElement("arrows-floating-button"),l.dataset.arrowsLink=t,l.dataset.arrowsNamespace=this.arrows.namespace,l.dataset.arrowsOrigin=d??"",h&&(l.dataset.arrowsConfig=JSON.stringify(h)),e!=null&&e.id&&(l.id=e.id),document.body.appendChild(l));const p=l.dataset;p.buttonText=r,p.hideButtonIcon=""+o,p.buttonPosition=""+i,p.buttonColor=""+a,p.buttonTextColor=""+n}modal({arrowsLink:t,config:r={},uid:o}){o=o||0;const e=document.querySelector(`arrows-modal-box[uid="${o}"]`);if(e){e.setAttribute("state","started");return}if(typeof r.iframeAttrs=="string"||r.iframeAttrs instanceof Array)throw new Error("iframeAttrs should be an object");r.embedType="modal";const i=document.body,a=this.arrows.createIframe({arrowsLink:t,queryObject:y(f.getQueryObject(r),i)});a.style.borderRadius="8px",a.style.height="100%",a.style.width="100%";const n=document.createElement("template");n.innerHTML=`<arrows-modal-box uid="${o}"></arrows-modal-box>`,this.arrows.modalBox=n.content.children[0],this.arrows.modalBox.appendChild(a),this.handleClose(),i.appendChild(n.content)}handleClose(){this.arrows.actionManager.on("__closeIframe",()=>{this.arrows.modalBox.setAttribute("state","closed")})}on({action:t,callback:r}){u(arguments[0],{required:!0,props:{action:{required:!0,type:"string"},callback:{required:!0,type:Function}}}),this.arrows.actionManager.on(t,r)}off({action:t,callback:r}){this.arrows.actionManager.off(t,r)}preload({arrowsLink:t}){u(arguments[0],{required:!0,props:{arrowsLink:{type:"string",required:!0}}});const r=document.body.appendChild(document.createElement("iframe")),o=this.arrows.getConfig(),e=new URL(`${o.arrowsOrigin}/${t}`);e.searchParams.set("prerender","true"),r.src=e.toString(),r.style.width="0",r.style.height="0",r.style.display="none"}ui(t){u(t,{required:!0,props:{theme:{required:!1,type:"string"},styles:{required:!1,type:Object}}}),this.arrows.doInIframe({method:"ui",arg:t})}};C.initializedNamespaces=[];let R=C;const M="";c.instance=new f(M,c.q);for(const[s,t]of Object.entries(c.ns))t.instance=new f(s,t.q);window.addEventListener("message",s=>{const t=s.data,r=t.fullType,o=x.parseAction(r);if(!o)return;const e=f.actionsManagers[o.ns];if(c.__logQueue=c.__logQueue||[],c.__logQueue.push({...o,data:t.data}),!e)throw new Error("Unhandled Action"+o);e.fire(o.type,t.data)});document.addEventListener("click",s=>{const t=s.target;if(!(t instanceof HTMLElement))return;const r=t.dataset.arrowsLink;if(!r)return;const o=t.dataset.uniqueId=t.dataset.uniqueId||String(Date.now()),e=t.dataset.arrowsNamespace,i=t.dataset.arrowsConfig||"",a=t.dataset.arrowsOrigin||"";let n;try{n=JSON.parse(i)}catch{n={}}let d=c;if(e&&(d=c.ns[e]),!d)throw new Error(`Namespace ${e} isn't defined`);d("modal",{arrowsLink:r,config:n,uid:o,arrowsOrigin:a})});let v=null;(function(){setInterval(()=>{const t=S(document.body);t&&t!==v&&(v=t,R.initializedNamespaces.forEach(r=>{j(r)("ui",{colorScheme:t})}))},50)})();function j(s){let t;return s===M?t=c:t=c.ns[s],t}
}()
{
"name": "@arrowshq/embed-core",
"version": "0.0.1",
"version": "0.0.2",
"description": "This is the vanilla JS core script that embeds Arrows Plan",

@@ -5,0 +5,0 @@ "main": "./dist/embed.js",

SocketSocket SOC 2 Logo

Product

  • Package Alerts
  • Integrations
  • Docs
  • Pricing
  • FAQ
  • Roadmap
  • Changelog

Packages

npm

Stay in touch

Get open source security insights delivered straight into your inbox.


  • Terms
  • Privacy
  • Security

Made with ⚡️ by Socket Inc