@tindtechnologies/universalviewer
Version:
The Universal Viewer is a community-developed open source project on a mission to help you share your 📚📜📰📽️📻🗿 with the 🌎
2 lines (1 loc) • 19.8 kB
JavaScript
import{a as y}from"./chunk-PU67WH5C.js";import{a as s}from"./chunk-47FI7OS3.js";import{c as h}from"./chunk-Y2TXPXZV.js";import{e as x,i as v,j as k,k as b,l as g,m as c,n as w}from"./chunk-LE3CSG7S.js";import"./chunk-4DAZ7WDM.js";import{a as A,e as a,f as C,i as l,l as I,o as d}from"./chunk-VNJCZCB4.js";import"./chunk-L67DAW3A.js";var D=function(i){var e=s(),r=s(),t=s();return r.addElement(i.querySelector("ion-backdrop")).fromTo("opacity",.01,.3),t.addElement(i.querySelector(".alert-wrapper")).keyframes([{offset:0,opacity:"0.01",transform:"scale(1.1)"},{offset:1,opacity:"1",transform:"scale(1)"}]),e.addElement(i).easing("ease-in-out").duration(200).addAnimation([r,t])},B=function(i){var e=s(),r=s(),t=s();return r.addElement(i.querySelector("ion-backdrop")).fromTo("opacity",.3,0),t.addElement(i.querySelector(".alert-wrapper")).keyframes([{offset:0,opacity:.99,transform:"scale(1)"},{offset:1,opacity:0,transform:"scale(0.9)"}]),e.addElement(i).easing("ease-in-out").duration(200).addAnimation([r,t])},T=function(i){var e=s(),r=s(),t=s();return r.addElement(i.querySelector("ion-backdrop")).fromTo("opacity",.01,.32),t.addElement(i.querySelector(".alert-wrapper")).keyframes([{offset:0,opacity:"0.01",transform:"scale(0.9)"},{offset:1,opacity:"1",transform:"scale(1)"}]),e.addElement(i).easing("ease-in-out").duration(150).addAnimation([r,t])},j=function(i){var e=s(),r=s(),t=s();return r.addElement(i.querySelector("ion-backdrop")).fromTo("opacity",.32,0),t.addElement(i.querySelector(".alert-wrapper")).fromTo("opacity",.99,0),e.addElement(i).easing("ease-in-out").duration(150).addAnimation([r,t])},W=function(){function i(e){var r=this;A(this,e),this.processedInputs=[],this.processedButtons=[],this.presented=!1,this.mode=d(this),this.keyboardClose=!0,this.buttons=[],this.inputs=[],this.backdropDismiss=!0,this.translucent=!1,this.animated=!0,this.onBackdropTap=function(){r.dismiss(void 0,w)},this.dispatchCancelHandler=function(t){var o=t.detail.role;if(g(o)){var n=r.processedButtons.find(function(p){return p.role==="cancel"});r.callButtonHandler(n)}},x(this.el),this.didPresent=l(this,"ionAlertDidPresent",7),this.willPresent=l(this,"ionAlertWillPresent",7),this.willDismiss=l(this,"ionAlertWillDismiss",7),this.didDismiss=l(this,"ionAlertDidDismiss",7)}return i.prototype.buttonsChanged=function(){var e=this.buttons;this.processedButtons=e.map(function(r){return typeof r=="string"?{text:r,role:r.toLowerCase()==="cancel"?"cancel":void 0}:r})},i.prototype.inputsChanged=function(){var e=this,r=this.inputs,t=new Set(r.map(function(o){return o.type}));t.has("checkbox")&&t.has("radio")&&console.warn("Alert cannot mix input types: "+Array.from(t.values()).join("/")+". Please see alert docs for more info."),this.inputType=t.values().next().value,this.processedInputs=r.map(function(o,n){return{type:o.type||"text",name:o.name||""+n,placeholder:o.placeholder||"",value:o.value,label:o.label,checked:!!o.checked,disabled:!!o.disabled,id:o.id||"alert-input-"+e.overlayIndex+"-"+n,handler:o.handler,min:o.min,max:o.max}})},i.prototype.componentWillLoad=function(){this.inputsChanged(),this.buttonsChanged()},i.prototype.present=function(){return v(this,"alertEnter",D,T)},i.prototype.dismiss=function(e,r){return k(this,e,r,"alertLeave",B,j)},i.prototype.onDidDismiss=function(){return b(this.el,"ionAlertDidDismiss")},i.prototype.onWillDismiss=function(){return b(this.el,"ionAlertWillDismiss")},i.prototype.rbClick=function(e){for(var r=0,t=this.processedInputs;r<t.length;r++){var o=t[r];o.checked=o===e}this.activeId=e.id,c(e.handler,e),this.el.forceUpdate()},i.prototype.cbClick=function(e){e.checked=!e.checked,c(e.handler,e),this.el.forceUpdate()},i.prototype.buttonClick=function(e){var r=e.role,t=this.getValues();if(g(r))return this.dismiss({values:t},r);var o=this.callButtonHandler(e,t);return o!==!1?this.dismiss(Object.assign({values:t},o),e.role):Promise.resolve(!1)},i.prototype.callButtonHandler=function(e,r){if(e&&e.handler){var t=c(e.handler,r);if(t===!1)return!1;if(typeof t=="object")return t}return{}},i.prototype.getValues=function(){if(this.processedInputs.length!==0){if(this.inputType==="radio"){var e=this.processedInputs.find(function(t){return!!t.checked});return e?e.value:void 0}if(this.inputType==="checkbox")return this.processedInputs.filter(function(t){return t.checked}).map(function(t){return t.value});var r={};return this.processedInputs.forEach(function(t){r[t.name]=t.value||""}),r}},i.prototype.renderAlertInputs=function(e){switch(this.inputType){case"checkbox":return this.renderCheckbox(e);case"radio":return this.renderRadio(e);default:return this.renderInput(e)}},i.prototype.renderCheckbox=function(e){var r=this,t=this.processedInputs,o=d(this);return t.length===0?null:a("div",{class:"alert-checkbox-group","aria-labelledby":e},t.map(function(n){return a("button",{type:"button",onClick:function(){return r.cbClick(n)},"aria-checked":""+n.checked,id:n.id,disabled:n.disabled,tabIndex:0,role:"checkbox",class:{"alert-tappable":!0,"alert-checkbox":!0,"alert-checkbox-button":!0,"ion-focusable":!0,"alert-checkbox-button-disabled":n.disabled||!1}},a("div",{class:"alert-button-inner"},a("div",{class:"alert-checkbox-icon"},a("div",{class:"alert-checkbox-inner"})),a("div",{class:"alert-checkbox-label"},n.label)),o==="md"&&a("ion-ripple-effect",null))}))},i.prototype.renderRadio=function(e){var r=this,t=this.processedInputs;return t.length===0?null:a("div",{class:"alert-radio-group",role:"radiogroup","aria-labelledby":e,"aria-activedescendant":this.activeId},t.map(function(o){return a("button",{type:"button",onClick:function(){return r.rbClick(o)},"aria-checked":""+o.checked,disabled:o.disabled,id:o.id,tabIndex:0,class:{"alert-radio-button":!0,"alert-tappable":!0,"alert-radio":!0,"ion-focusable":!0,"alert-radio-button-disabled":o.disabled||!1},role:"radio"},a("div",{class:"alert-button-inner"},a("div",{class:"alert-radio-icon"},a("div",{class:"alert-radio-inner"})),a("div",{class:"alert-radio-label"},o.label)))}))},i.prototype.renderInput=function(e){var r=this.processedInputs;return r.length===0?null:a("div",{class:"alert-input-group","aria-labelledby":e},r.map(function(t){return a("div",{class:"alert-input-wrapper"},a("input",{placeholder:t.placeholder,value:t.value,type:t.type,min:t.min,max:t.max,onInput:function(o){return t.value=o.target.value},id:t.id,disabled:t.disabled,tabIndex:0,class:{"alert-input":!0,"alert-input-disabled":t.disabled||!1}}))}))},i.prototype.renderAlertButtons=function(){var e=this,r=this.processedButtons,t=d(this),o={"alert-button-group":!0,"alert-button-group-vertical":r.length>2};return a("div",{class:o},r.map(function(n){return a("button",{type:"button",class:H(n),tabIndex:0,onClick:function(){return e.buttonClick(n)}},a("span",{class:"alert-button-inner"},n.text),t==="md"&&a("ion-ripple-effect",null))}))},i.prototype.render=function(){var e,r=this,t=r.overlayIndex,o=r.header,n=r.subHeader,p=d(this),f="alert-"+t+"-hdr",m="alert-"+t+"-sub-hdr",z="alert-"+t+"-msg",u;return o!==void 0?u=f:n!==void 0&&(u=m),a(C,{role:"dialog","aria-modal":"true",style:{zIndex:""+(2e4+t)},class:Object.assign(Object.assign({},h(this.cssClass)),(e={},e[p]=!0,e["alert-translucent"]=this.translucent,e)),onIonAlertWillDismiss:this.dispatchCancelHandler,onIonBackdropTap:this.onBackdropTap},a("ion-backdrop",{tappable:this.backdropDismiss}),a("div",{class:"alert-wrapper"},a("div",{class:"alert-head"},o&&a("h2",{id:f,class:"alert-title"},o),n&&a("h2",{id:m,class:"alert-sub-title"},n)),a("div",{id:z,class:"alert-message",innerHTML:y(this.message)}),this.renderAlertInputs(u),this.renderAlertButtons()))},Object.defineProperty(i.prototype,"el",{get:function(){return I(this)},enumerable:!0,configurable:!0}),Object.defineProperty(i,"watchers",{get:function(){return{buttons:["buttonsChanged"],inputs:["inputsChanged"]}},enumerable:!0,configurable:!0}),Object.defineProperty(i,"style",{get:function(){return".sc-ion-alert-ios-h{--min-width:250px;--width:auto;--min-height:auto;--height:auto;--max-height:90%;-moz-osx-font-smoothing:grayscale;-webkit-font-smoothing:antialiased;left:0;right:0;top:0;bottom:0;display:-ms-flexbox;display:flex;position:fixed;-ms-flex-align:center;align-items:center;-ms-flex-pack:center;justify-content:center;font-family:var(--ion-font-family,inherit);contain:strict;-ms-touch-action:none;touch-action:none;-webkit-user-select:none;-moz-user-select:none;-ms-user-select:none;user-select:none;z-index:1001}.overlay-hidden.sc-ion-alert-ios-h{display:none}.alert-top.sc-ion-alert-ios-h{padding-top:50px;-ms-flex-align:start;align-items:flex-start}.alert-wrapper.sc-ion-alert-ios{display:-ms-flexbox;display:flex;-ms-flex-direction:column;flex-direction:column;width:var(--width);min-width:var(--min-width);max-width:var(--max-width);height:var(--height);min-height:var(--min-height);max-height:var(--max-height);background:var(--background);contain:content;opacity:0;z-index:10}.alert-title.sc-ion-alert-ios{margin-top:0}.alert-sub-title.sc-ion-alert-ios, .alert-title.sc-ion-alert-ios{margin-left:0;margin-right:0;margin-bottom:0;padding-left:0;padding-right:0;padding-top:0;padding-bottom:0}.alert-sub-title.sc-ion-alert-ios{margin-top:5px;font-weight:400}.alert-message.sc-ion-alert-ios{-webkit-box-sizing:border-box;box-sizing:border-box;-webkit-overflow-scrolling:touch;overflow-y:auto;overscroll-behavior-y:contain}.alert-checkbox-group.sc-ion-alert-ios::-webkit-scrollbar, .alert-message.sc-ion-alert-ios::-webkit-scrollbar, .alert-radio-group.sc-ion-alert-ios::-webkit-scrollbar{display:none}.alert-input.sc-ion-alert-ios{padding-left:0;padding-right:0;padding-top:10px;padding-bottom:10px;width:100%;border:0;background:inherit;font:inherit;-webkit-box-sizing:border-box;box-sizing:border-box}.alert-button-group.sc-ion-alert-ios{display:-ms-flexbox;display:flex;-ms-flex-direction:row;flex-direction:row;width:100%}.alert-button-group-vertical.sc-ion-alert-ios{-ms-flex-direction:column;flex-direction:column;-ms-flex-wrap:nowrap;flex-wrap:nowrap}.alert-button.sc-ion-alert-ios{display:block;border:0;font-size:14px;line-height:20px;z-index:0}.alert-button.ion-focused.sc-ion-alert-ios, .alert-tappable.ion-focused.sc-ion-alert-ios{background:var(--ion-color-step-100,#e6e6e6)}.alert-button-inner.sc-ion-alert-ios{display:-ms-flexbox;display:flex;-ms-flex-flow:row nowrap;flex-flow:row nowrap;-ms-flex-negative:0;flex-shrink:0;-ms-flex-align:center;align-items:center;-ms-flex-pack:center;justify-content:center;width:100%;height:100%}.alert-checkbox-button-disabled.sc-ion-alert-ios .alert-button-inner.sc-ion-alert-ios, .alert-input-disabled.sc-ion-alert-ios, .alert-radio-button-disabled.sc-ion-alert-ios .alert-button-inner.sc-ion-alert-ios{cursor:default;opacity:.5;pointer-events:none}.alert-tappable.sc-ion-alert-ios{margin-left:0;margin-right:0;margin-top:0;margin-bottom:0;padding-left:0;padding-right:0;padding-top:0;padding-bottom:0;display:-ms-flexbox;display:flex;width:100%;border:0;background:transparent;font-size:inherit;line-height:normal;text-align:start;-webkit-appearance:none;-moz-appearance:none;appearance:none;contain:strict}.alert-button.sc-ion-alert-ios, .alert-checkbox.sc-ion-alert-ios, .alert-input.sc-ion-alert-ios, .alert-radio.sc-ion-alert-ios{outline:none}.alert-checkbox-icon.sc-ion-alert-ios, .alert-checkbox-inner.sc-ion-alert-ios, .alert-radio-icon.sc-ion-alert-ios{-webkit-box-sizing:border-box;box-sizing:border-box}.sc-ion-alert-ios-h{--background:var(--ion-overlay-background-color,var(--ion-color-step-100,#f9f9f9));--max-width:270px;font-size:14px}.alert-wrapper.sc-ion-alert-ios{border-radius:13px;-webkit-box-shadow:none;box-shadow:none;overflow:hidden}@supports ((-webkit-backdrop-filter:blur(0)) or (backdrop-filter:blur(0))){.alert-translucent.sc-ion-alert-ios-h .alert-wrapper.sc-ion-alert-ios{background:rgba(var(--ion-background-color-rgb,255,255,255),.9);-webkit-backdrop-filter:saturate(180%) blur(20px);backdrop-filter:saturate(180%) blur(20px)}}.alert-head.sc-ion-alert-ios{padding-left:16px;padding-right:16px;padding-top:12px;padding-bottom:7px;text-align:center}@supports ((-webkit-margin-start:0) or (margin-inline-start:0)) or (-webkit-margin-start:0){.alert-head.sc-ion-alert-ios{padding-left:unset;padding-right:unset;-webkit-padding-start:16px;padding-inline-start:16px;-webkit-padding-end:16px;padding-inline-end:16px}}.alert-title.sc-ion-alert-ios{margin-top:8px;color:var(--ion-text-color,#000);font-size:17px;font-weight:600}.alert-sub-title.sc-ion-alert-ios{color:var(--ion-color-step-600,#666);font-size:14px}.alert-input-group.sc-ion-alert-ios, .alert-message.sc-ion-alert-ios{padding-left:16px;padding-right:16px;padding-top:0;padding-bottom:21px;color:var(--ion-text-color,#000);font-size:13px;text-align:center}@supports ((-webkit-margin-start:0) or (margin-inline-start:0)) or (-webkit-margin-start:0){.alert-input-group.sc-ion-alert-ios, .alert-message.sc-ion-alert-ios{padding-left:unset;padding-right:unset;-webkit-padding-start:16px;padding-inline-start:16px;-webkit-padding-end:16px;padding-inline-end:16px}}.alert-message.sc-ion-alert-ios{max-height:240px}.alert-message.sc-ion-alert-ios:empty{padding-left:0;padding-right:0;padding-top:0;padding-bottom:12px}.alert-input.sc-ion-alert-ios{border-radius:4px;margin-top:10px;padding-left:6px;padding-right:6px;padding-top:6px;padding-bottom:6px;border:.55px solid var(--ion-color-step-250,#bfbfbf);background-color:var(--ion-background-color,#fff);-webkit-appearance:none;-moz-appearance:none;appearance:none}@supports ((-webkit-margin-start:0) or (margin-inline-start:0)) or (-webkit-margin-start:0){.alert-input.sc-ion-alert-ios{padding-left:unset;padding-right:unset;-webkit-padding-start:6px;padding-inline-start:6px;-webkit-padding-end:6px;padding-inline-end:6px}}.alert-input.sc-ion-alert-ios::-webkit-input-placeholder{color:var(--ion-placeholder-color,var(--ion-color-step-400,#999));font-family:inherit;font-weight:inherit}.alert-input.sc-ion-alert-ios::-moz-placeholder{color:var(--ion-placeholder-color,var(--ion-color-step-400,#999));font-family:inherit;font-weight:inherit}.alert-input.sc-ion-alert-ios:-ms-input-placeholder{color:var(--ion-placeholder-color,var(--ion-color-step-400,#999));font-family:inherit;font-weight:inherit}.alert-input.sc-ion-alert-ios::-ms-input-placeholder{color:var(--ion-placeholder-color,var(--ion-color-step-400,#999));font-family:inherit;font-weight:inherit}.alert-input.sc-ion-alert-ios::placeholder{color:var(--ion-placeholder-color,var(--ion-color-step-400,#999));font-family:inherit;font-weight:inherit}.alert-input.sc-ion-alert-ios::-ms-clear{display:none}.alert-checkbox-group.sc-ion-alert-ios, .alert-radio-group.sc-ion-alert-ios{-ms-scroll-chaining:none;overscroll-behavior:contain;max-height:240px;border-top:.55px solid rgba(var(--ion-text-color-rgb,0,0,0),.2);overflow-y:auto;-webkit-overflow-scrolling:touch}.alert-tappable.sc-ion-alert-ios{height:44px}.alert-radio-label.sc-ion-alert-ios{padding-left:13px;padding-right:13px;padding-top:13px;padding-bottom:13px;-ms-flex:1;flex:1;-ms-flex-order:0;order:0;color:var(--ion-text-color,#000);text-overflow:ellipsis;white-space:nowrap;overflow:hidden}@supports ((-webkit-margin-start:0) or (margin-inline-start:0)) or (-webkit-margin-start:0){.alert-radio-label.sc-ion-alert-ios{padding-left:unset;padding-right:unset;-webkit-padding-start:13px;padding-inline-start:13px;-webkit-padding-end:13px;padding-inline-end:13px}}[aria-checked=true].sc-ion-alert-ios .alert-radio-label.sc-ion-alert-ios{color:var(--ion-color-primary,#3880ff)}.alert-radio-icon.sc-ion-alert-ios{position:relative;-ms-flex-order:1;order:1;min-width:30px}[aria-checked=true].sc-ion-alert-ios .alert-radio-inner.sc-ion-alert-ios{left:7px;top:-7px;position:absolute;width:6px;height:12px;-webkit-transform:rotate(45deg);transform:rotate(45deg);border-width:2px;border-top-width:0;border-left-width:0;border-style:solid;border-color:var(--ion-color-primary,#3880ff)}[dir=rtl].sc-ion-alert-ios-h [aria-checked=true].sc-ion-alert-ios .alert-radio-inner.sc-ion-alert-ios, [dir=rtl] .sc-ion-alert-ios-h [aria-checked=true].sc-ion-alert-ios .alert-radio-inner.sc-ion-alert-ios, [dir=rtl].sc-ion-alert-ios [aria-checked=true].sc-ion-alert-ios .alert-radio-inner.sc-ion-alert-ios{left:unset;right:unset;right:7px}.alert-checkbox-label.sc-ion-alert-ios{padding-left:13px;padding-right:13px;padding-top:13px;padding-bottom:13px;-ms-flex:1;flex:1;color:var(--ion-text-color,#000);text-overflow:ellipsis;white-space:nowrap;overflow:hidden}@supports ((-webkit-margin-start:0) or (margin-inline-start:0)) or (-webkit-margin-start:0){.alert-checkbox-label.sc-ion-alert-ios{padding-left:unset;padding-right:unset;-webkit-padding-start:13px;padding-inline-start:13px;-webkit-padding-end:13px;padding-inline-end:13px}}.alert-checkbox-icon.sc-ion-alert-ios{border-radius:50%;margin-left:16px;margin-right:6px;margin-top:10px;margin-bottom:10px;position:relative;width:24px;height:24px;border-width:1px;border-style:solid;border-color:var(--ion-item-border-color,var(--ion-border-color,var(--ion-color-step-250,#c8c7cc)));background-color:var(--ion-item-background,var(--ion-background-color,#fff));contain:strict}@supports ((-webkit-margin-start:0) or (margin-inline-start:0)) or (-webkit-margin-start:0){.alert-checkbox-icon.sc-ion-alert-ios{margin-left:unset;margin-right:unset;-webkit-margin-start:16px;margin-inline-start:16px;-webkit-margin-end:6px;margin-inline-end:6px}}[aria-checked=true].sc-ion-alert-ios .alert-checkbox-icon.sc-ion-alert-ios{border-color:var(--ion-color-primary,#3880ff);background-color:var(--ion-color-primary,#3880ff)}[aria-checked=true].sc-ion-alert-ios .alert-checkbox-inner.sc-ion-alert-ios{left:9px;top:4px;position:absolute;width:5px;height:12px;-webkit-transform:rotate(45deg);transform:rotate(45deg);border-width:1px;border-top-width:0;border-left-width:0;border-style:solid;border-color:var(--ion-background-color,#fff)}[dir=rtl].sc-ion-alert-ios-h [aria-checked=true].sc-ion-alert-ios .alert-checkbox-inner.sc-ion-alert-ios, [dir=rtl] .sc-ion-alert-ios-h [aria-checked=true].sc-ion-alert-ios .alert-checkbox-inner.sc-ion-alert-ios, [dir=rtl].sc-ion-alert-ios [aria-checked=true].sc-ion-alert-ios .alert-checkbox-inner.sc-ion-alert-ios{left:unset;right:unset;right:9px}.alert-button-group.sc-ion-alert-ios{margin-right:-.55px;-ms-flex-wrap:wrap;flex-wrap:wrap}@supports ((-webkit-margin-start:0) or (margin-inline-start:0)) or (-webkit-margin-start:0){.alert-button-group.sc-ion-alert-ios{margin-right:unset;-webkit-margin-end:-.55px;margin-inline-end:-.55px}}.alert-button.sc-ion-alert-ios{margin-left:0;margin-right:0;margin-top:0;margin-bottom:0;border-radius:0;-ms-flex:1 1 auto;flex:1 1 auto;min-width:50%;height:44px;border-top:.55px solid rgba(var(--ion-text-color-rgb,0,0,0),.2);border-right:.55px solid rgba(var(--ion-text-color-rgb,0,0,0),.2);background-color:transparent;color:var(--ion-color-primary,#3880ff);font-size:17px;overflow:hidden}[dir=rtl].sc-ion-alert-ios-h .alert-button.sc-ion-alert-ios:first-child, [dir=rtl] .sc-ion-alert-ios-h .alert-button.sc-ion-alert-ios:first-child, [dir=rtl].sc-ion-alert-ios .alert-button.sc-ion-alert-ios:first-child{border-right:0}.alert-button.sc-ion-alert-ios:last-child{border-right:0;font-weight:700}[dir=rtl].sc-ion-alert-ios-h .alert-button.sc-ion-alert-ios:last-child, [dir=rtl] .sc-ion-alert-ios-h .alert-button.sc-ion-alert-ios:last-child, [dir=rtl].sc-ion-alert-ios .alert-button.sc-ion-alert-ios:last-child{border-right:.55px solid rgba(var(--ion-text-color-rgb,0,0,0),.2)}.alert-button.activated.sc-ion-alert-ios{background-color:rgba(var(--ion-text-color-rgb,0,0,0),.1)}"},enumerable:!0,configurable:!0}),i}(),H=function(i){return Object.assign({"alert-button":!0,"ion-focusable":!0,"ion-activatable":!0},h(i.cssClass))};export{W as ion_alert};