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A;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,OAAO;AACP;AACA;AACA;AACA;AACA;AACA;AACA;AACA,KAAK;AACL;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,KAAK;AACL;AACA;AACA;AACA;AACA;AACA;AACA,kDAAkD,gBAAgB;AAClE;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,0BAA0B,aAAa,GAAG,YAAY;AACtD;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,KAAK;AACL;AACA;AACA;AACA;AACA;AACA;AACA;AACA,KAAK;AACL;AACA;AACA;AACA;AACA;AACA;AACA;AACA,0BAA0B,aAAa,GAAG,YAAY;AACtD;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,KAAK;AACL;AACA;AACA;AACA;AACA;AACA;AACA;AACA,0BAA0B,aAAa,GAAG,YAAY;AACtD;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,KAAK;AACL;AACA;AACA;AACA;AACA,iBAAiB,mEAAU;AAC3B;AACA,qDAAqD,OAAO,sBAAsB;AAClF;AACA;AACA;AACA;AACA;AACA,OAAO,EAAE;AACT,WAAW,uDAAiB;AAC5B;AACA;AACA,iBAAiB,mEAAU;AAC3B;AACA,yDAAyD,OAAO,sBAAsB,mIAAmI;AACzN,WAAW,uDAAqB;AAChC;AACA;AACA;AACA;AACA;AACA;AACA,iBAAiB,mEAAU;AAC3B,mDAAmD,OAAO,sBAAsB;AAChF;AACA;AACA;AACA;AACA;AACA;AACA,SAAS;AACT;AACA;AACA;AACA;AACA;AACA;AACA;AACA,4EAA4E;AAC5E,WAAW,uDAAe;AAC1B;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,WAAW,8DAAa;AACxB;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,KAAK;AACL;AACA;AACA,WAAW,8DAA8D;AACzE,iBAAiB,mEAAU;AAC3B,WAAW,qBAAqB,GAAG,8DAAY;AAC/C,IAAI,8DAAiB;AACrB;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,gCAAgC,WAAW,IAAI,UAAU;AACzD;AACA,YAAY,4DAAC,CAAC,oDAAI,GAAG;AACrB;AACA,mBAAmB,4DAAW;AAC9B;AACA,OAAO,EAAE,EAAE,4DAAC,SAAS,kEAAkE,eAAe,4DAAC,SAAS,2DAA2D,EAAE,4DAAC,SAAS,6BAA6B,IAAI,4DAAC,WAAW,cAAc,iBAAiB,4DAAC,YAAY,8HAA8H,WAAW,yFAAyF;AAClf;AACA,YAAY,QAAQ,4DAAU,OAAO;AACrC,yBAAyB;AACzB;AACA;AACA;AACA,IAAI;AACJ;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,GAAG;AACH;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;AAEA,+BAA+B,aAAa;;AAE5C;AACA;AACA,IAAI,4DAAgB;AACpB,iCAAiC,kBAAkB;AACnD;AACA;AACA;AACA;AACA;AACA;AACA,YAAY,4DAAC,CAAC,oDAAI,GAAG,0CAA0C,mEAAU,QAAQ;AACjF;AACA,YAAY,QAAQ,4DAAU,OAAO;AACrC;AACA;AACA;;AAEA,kFAAkF,cAAc,eAAe,gBAAgB,mBAAmB,wHAAwH,cAAc,eAAe,aAAa,gBAAgB;;AAEpU;AACA;AACA,IAAI,4DAAgB;AACpB;AACA;AACA;AACA;AACA;AACA;AACA,MAAM,+DAAQ;AACd;AACA;AACA;AACA;AACA;AACA,YAAY,4DAAC,CAAC,oDAAI,GAAG,QAAQ,mEAAU,QAAQ,EAAE,4DAAC,gDAAgD,4DAAC;AACnG,MAAM,4DAAC,mBAAmB,4DAAC,eAAe,yBAAyB,kCAAkC,4DAAC,4DAA4D,4DAAC,6BAA6B,4DAAC,qBAAqB,sBAAsB,6BAA6B,4DAAC,cAAc,QAAQ,4DAAW,mBAAmB,EAAE,4DAAC,kCAAkC,4DAAC,eAAe,iDAAiD;AACpa;AACA;AACA;;AAEwG","file":"32-es2015.js","sourcesContent":["import { r as registerInstance, e as createEvent, h, H as Host, i as getElement } from './index-e806d1f6.js';\nimport { b as getIonMode } from './ionic-global-9d5c8ee3.js';\nimport { f as findItemLabel, c as getAriaLabel, d as renderHiddenInput } from './helpers-90f46169.js';\nimport './hardware-back-button-389954a0.js';\nimport { c as popoverController, b as actionSheetController, a as alertController, s as safeCall } from './overlays-7a1610a2.js';\nimport { h as hostContext, g as getClassMap } from './theme-ff3fc52f.js';\n\nconst watchForOptions = (containerEl, tagName, onChange) => {\n /* tslint:disable-next-line */\n if (typeof MutationObserver === 'undefined') {\n return;\n }\n const mutation = new MutationObserver(mutationList => {\n onChange(getSelectedOption(mutationList, tagName));\n });\n mutation.observe(containerEl, {\n childList: true,\n subtree: true\n });\n return mutation;\n};\nconst getSelectedOption = (mutationList, tagName) => {\n let newOption;\n mutationList.forEach(mut => {\n // tslint:disable-next-line: prefer-for-of\n for (let i = 0; i < mut.addedNodes.length; i++) {\n newOption = findCheckedOption(mut.addedNodes[i], tagName) || newOption;\n }\n });\n return newOption;\n};\nconst findCheckedOption = (el, tagName) => {\n if (el.nodeType !== 1) {\n return undefined;\n }\n const options = (el.tagName === tagName.toUpperCase())\n ? [el]\n : Array.from(el.querySelectorAll(tagName));\n return options.find((o) => o.value === el.value);\n};\n\nconst selectIosCss = \":host{--placeholder-color:currentColor;--placeholder-opacity:0.33;padding-left:var(--padding-start);padding-right:var(--padding-end);padding-top:var(--padding-top);padding-bottom:var(--padding-bottom);display:-ms-flexbox;display:flex;position:relative;-ms-flex-align:center;align-items:center;font-family:var(--ion-font-family, inherit);overflow:hidden;z-index:2}@supports ((-webkit-margin-start: 0) or (margin-inline-start: 0)) or (-webkit-margin-start: 0){:host{padding-left:unset;padding-right:unset;-webkit-padding-start:var(--padding-start);padding-inline-start:var(--padding-start);-webkit-padding-end:var(--padding-end);padding-inline-end:var(--padding-end)}}:host(.in-item){position:static;max-width:45%}:host(.select-disabled){opacity:0.4;pointer-events:none}:host(.ion-focused) button{border:2px solid #5e9ed6}.select-placeholder{color:var(--placeholder-color);opacity:var(--placeholder-opacity)}label{left:0;top:0;margin-left:0;margin-right:0;margin-top:0;margin-bottom:0;position:absolute;width:100%;height:100%;border:0;background:transparent;cursor:pointer;-webkit-appearance:none;-moz-appearance:none;appearance:none;outline:none;display:-ms-flexbox;display:flex;-ms-flex-align:center;align-items:center;opacity:0}[dir=rtl] label,:host-context([dir=rtl]) label{left:unset;right:unset;right:0}label::-moz-focus-inner{border:0}button{position:absolute;top:0;left:0;right:0;bottom:0;width:100%;height:100%;margin:0;padding:0;border:0;outline:0;clip:rect(0 0 0 0);opacity:0;overflow:hidden;-webkit-appearance:none;-moz-appearance:none}.select-icon{position:relative;opacity:0.33}.select-text{-ms-flex:1;flex:1;min-width:16px;font-size:inherit;text-overflow:ellipsis;white-space:nowrap;overflow:hidden}.select-icon-inner{left:5px;top:50%;margin-top:-2px;position:absolute;width:0;height:0;border-top:5px solid;border-right:5px solid transparent;border-left:5px solid transparent;color:currentColor;pointer-events:none}[dir=rtl] .select-icon-inner,:host-context([dir=rtl]) .select-icon-inner{left:unset;right:unset;right:5px}:host{--padding-top:10px;--padding-end:10px;--padding-bottom:10px;--padding-start:20px}.select-icon{width:12px;height:18px}\";\n\nconst selectMdCss = \":host{--placeholder-color:currentColor;--placeholder-opacity:0.33;padding-left:var(--padding-start);padding-right:var(--padding-end);padding-top:var(--padding-top);padding-bottom:var(--padding-bottom);display:-ms-flexbox;display:flex;position:relative;-ms-flex-align:center;align-items:center;font-family:var(--ion-font-family, inherit);overflow:hidden;z-index:2}@supports ((-webkit-margin-start: 0) or (margin-inline-start: 0)) or (-webkit-margin-start: 0){:host{padding-left:unset;padding-right:unset;-webkit-padding-start:var(--padding-start);padding-inline-start:var(--padding-start);-webkit-padding-end:var(--padding-end);padding-inline-end:var(--padding-end)}}:host(.in-item){position:static;max-width:45%}:host(.select-disabled){opacity:0.4;pointer-events:none}:host(.ion-focused) button{border:2px solid #5e9ed6}.select-placeholder{color:var(--placeholder-color);opacity:var(--placeholder-opacity)}label{left:0;top:0;margin-left:0;margin-right:0;margin-top:0;margin-bottom:0;position:absolute;width:100%;height:100%;border:0;background:transparent;cursor:pointer;-webkit-appearance:none;-moz-appearance:none;appearance:none;outline:none;display:-ms-flexbox;display:flex;-ms-flex-align:center;align-items:center;opacity:0}[dir=rtl] label,:host-context([dir=rtl]) label{left:unset;right:unset;right:0}label::-moz-focus-inner{border:0}button{position:absolute;top:0;left:0;right:0;bottom:0;width:100%;height:100%;margin:0;padding:0;border:0;outline:0;clip:rect(0 0 0 0);opacity:0;overflow:hidden;-webkit-appearance:none;-moz-appearance:none}.select-icon{position:relative;opacity:0.33}.select-text{-ms-flex:1;flex:1;min-width:16px;font-size:inherit;text-overflow:ellipsis;white-space:nowrap;overflow:hidden}.select-icon-inner{left:5px;top:50%;margin-top:-2px;position:absolute;width:0;height:0;border-top:5px solid;border-right:5px solid transparent;border-left:5px solid transparent;color:currentColor;pointer-events:none}[dir=rtl] .select-icon-inner,:host-context([dir=rtl]) .select-icon-inner{left:unset;right:unset;right:5px}:host{--padding-top:10px;--padding-end:0;--padding-bottom:10px;--padding-start:16px}.select-icon{width:19px;height:19px}:host-context(.item-label-floating) .select-icon{-webkit-transform:translate3d(0, -9px, 0);transform:translate3d(0, -9px, 0)}\";\n\nconst Select = class {\n constructor(hostRef) {\n registerInstance(this, hostRef);\n this.ionChange = createEvent(this, \"ionChange\", 7);\n this.ionCancel = createEvent(this, \"ionCancel\", 7);\n this.ionFocus = createEvent(this, \"ionFocus\", 7);\n this.ionBlur = createEvent(this, \"ionBlur\", 7);\n this.ionStyle = createEvent(this, \"ionStyle\", 7);\n this.inputId = `ion-sel-${selectIds++}`;\n this.didInit = false;\n this.isExpanded = false;\n /**\n * If `true`, the user cannot interact with the select.\n */\n this.disabled = false;\n /**\n * The text to display on the cancel button.\n */\n this.cancelText = 'Cancel';\n /**\n * The text to display on the ok button.\n */\n this.okText = 'OK';\n /**\n * The name of the control, which is submitted with the form data.\n */\n this.name = this.inputId;\n /**\n * If `true`, the select can accept multiple values.\n */\n this.multiple = false;\n /**\n * The interface the select should use: `action-sheet`, `popover` or `alert`.\n */\n this.interface = 'alert';\n /**\n * Any additional options that the `alert`, `action-sheet` or `popover` interface\n * can take. See the [ion-alert docs](../alert), the\n * [ion-action-sheet docs](../action-sheet) and the\n * [ion-popover docs](../popover) for the\n * create options for each interface.\n *\n * Note: `interfaceOptions` will not override `inputs` or `buttons` with the `alert` interface.\n */\n this.interfaceOptions = {};\n this.onClick = (ev) => {\n this.setFocus();\n this.open(ev);\n };\n this.onFocus = () => {\n this.ionFocus.emit();\n };\n this.onBlur = () => {\n this.ionBlur.emit();\n };\n }\n disabledChanged() {\n this.emitStyle();\n }\n valueChanged() {\n this.emitStyle();\n if (this.didInit) {\n this.ionChange.emit({\n value: this.value,\n });\n }\n }\n async connectedCallback() {\n this.updateOverlayOptions();\n this.emitStyle();\n this.mutationO = watchForOptions(this.el, 'ion-select-option', async () => {\n this.updateOverlayOptions();\n });\n }\n disconnectedCallback() {\n if (this.mutationO) {\n this.mutationO.disconnect();\n this.mutationO = undefined;\n }\n }\n componentDidLoad() {\n this.didInit = true;\n }\n /**\n * Open the select overlay. The overlay is either an alert, action sheet, or popover,\n * depending on the `interface` property on the `ion-select`.\n *\n * @param event The user interface event that called the open.\n */\n async open(event) {\n if (this.disabled || this.isExpanded) {\n return undefined;\n }\n const overlay = this.overlay = await this.createOverlay(event);\n this.isExpanded = true;\n overlay.onDidDismiss().then(() => {\n this.overlay = undefined;\n this.isExpanded = false;\n this.setFocus();\n });\n await overlay.present();\n return overlay;\n }\n createOverlay(ev) {\n let selectInterface = this.interface;\n if ((selectInterface === 'action-sheet' || selectInterface === 'popover') && this.multiple) {\n console.warn(`Select interface cannot be \"${selectInterface}\" with a multi-value select. Using the \"alert\" interface instead.`);\n selectInterface = 'alert';\n }\n if (selectInterface === 'popover' && !ev) {\n console.warn('Select interface cannot be a \"popover\" without passing an event. Using the \"alert\" interface instead.');\n selectInterface = 'alert';\n }\n if (selectInterface === 'popover') {\n return this.openPopover(ev);\n }\n if (selectInterface === 'action-sheet') {\n return this.openActionSheet();\n }\n return this.openAlert();\n }\n updateOverlayOptions() {\n const overlay = this.overlay;\n if (!overlay) {\n return;\n }\n const childOpts = this.childOpts;\n const value = this.value;\n switch (this.interface) {\n case 'action-sheet':\n overlay.buttons = this.createActionSheetButtons(childOpts, value);\n break;\n case 'popover':\n const popover = overlay.querySelector('ion-select-popover');\n if (popover) {\n popover.options = this.createPopoverOptions(childOpts, value);\n }\n break;\n case 'alert':\n const inputType = (this.multiple ? 'checkbox' : 'radio');\n overlay.inputs = this.createAlertInputs(childOpts, inputType, value);\n break;\n }\n }\n createActionSheetButtons(data, selectValue) {\n const actionSheetButtons = data.map(option => {\n const value = getOptionValue(option);\n // Remove hydrated before copying over classes\n const copyClasses = Array.from(option.classList).filter(cls => cls !== 'hydrated').join(' ');\n const optClass = `${OPTION_CLASS} ${copyClasses}`;\n return {\n role: (isOptionSelected(value, selectValue, this.compareWith) ? 'selected' : ''),\n text: option.textContent,\n cssClass: optClass,\n handler: () => {\n this.value = value;\n }\n };\n });\n // Add \"cancel\" button\n actionSheetButtons.push({\n text: this.cancelText,\n role: 'cancel',\n handler: () => {\n this.ionCancel.emit();\n }\n });\n return actionSheetButtons;\n }\n createAlertInputs(data, inputType, selectValue) {\n const alertInputs = data.map(option => {\n const value = getOptionValue(option);\n // Remove hydrated before copying over classes\n const copyClasses = Array.from(option.classList).filter(cls => cls !== 'hydrated').join(' ');\n const optClass = `${OPTION_CLASS} ${copyClasses}`;\n return {\n type: inputType,\n cssClass: optClass,\n label: option.textContent || '',\n value,\n checked: isOptionSelected(value, selectValue, this.compareWith),\n disabled: option.disabled\n };\n });\n return alertInputs;\n }\n createPopoverOptions(data, selectValue) {\n const popoverOptions = data.map(option => {\n const value = getOptionValue(option);\n // Remove hydrated before copying over classes\n const copyClasses = Array.from(option.classList).filter(cls => cls !== 'hydrated').join(' ');\n const optClass = `${OPTION_CLASS} ${copyClasses}`;\n return {\n text: option.textContent || '',\n cssClass: optClass,\n value,\n checked: isOptionSelected(value, selectValue, this.compareWith),\n disabled: option.disabled,\n handler: () => {\n this.value = value;\n this.close();\n }\n };\n });\n return popoverOptions;\n }\n async openPopover(ev) {\n const interfaceOptions = this.interfaceOptions;\n const mode = getIonMode(this);\n const value = this.value;\n const popoverOpts = Object.assign(Object.assign({ mode }, interfaceOptions), { component: 'ion-select-popover', cssClass: ['select-popover', interfaceOptions.cssClass], event: ev, componentProps: {\n header: interfaceOptions.header,\n subHeader: interfaceOptions.subHeader,\n message: interfaceOptions.message,\n value,\n options: this.createPopoverOptions(this.childOpts, value)\n } });\n return popoverController.create(popoverOpts);\n }\n async openActionSheet() {\n const mode = getIonMode(this);\n const interfaceOptions = this.interfaceOptions;\n const actionSheetOpts = Object.assign(Object.assign({ mode }, interfaceOptions), { buttons: this.createActionSheetButtons(this.childOpts, this.value), cssClass: ['select-action-sheet', interfaceOptions.cssClass] });\n return actionSheetController.create(actionSheetOpts);\n }\n async openAlert() {\n const label = this.getLabel();\n const labelText = (label) ? label.textContent : null;\n const interfaceOptions = this.interfaceOptions;\n const inputType = (this.multiple ? 'checkbox' : 'radio');\n const mode = getIonMode(this);\n const alertOpts = Object.assign(Object.assign({ mode }, interfaceOptions), { header: interfaceOptions.header ? interfaceOptions.header : labelText, inputs: this.createAlertInputs(this.childOpts, inputType, this.value), buttons: [\n {\n text: this.cancelText,\n role: 'cancel',\n handler: () => {\n this.ionCancel.emit();\n }\n },\n {\n text: this.okText,\n handler: (selectedValues) => {\n this.value = selectedValues;\n }\n }\n ], cssClass: ['select-alert', interfaceOptions.cssClass,\n (this.multiple ? 'multiple-select-alert' : 'single-select-alert')] });\n return alertController.create(alertOpts);\n }\n /**\n * Close the select interface.\n */\n close() {\n // TODO check !this.overlay || !this.isFocus()\n if (!this.overlay) {\n return Promise.resolve(false);\n }\n return this.overlay.dismiss();\n }\n getLabel() {\n return findItemLabel(this.el);\n }\n hasValue() {\n return this.getText() !== '';\n }\n get childOpts() {\n return Array.from(this.el.querySelectorAll('ion-select-option'));\n }\n getText() {\n const selectedText = this.selectedText;\n if (selectedText != null && selectedText !== '') {\n return selectedText;\n }\n return generateText(this.childOpts, this.value, this.compareWith);\n }\n setFocus() {\n if (this.focusEl) {\n this.focusEl.focus();\n }\n }\n emitStyle() {\n this.ionStyle.emit({\n 'interactive': true,\n 'select': true,\n 'has-placeholder': this.placeholder != null,\n 'has-value': this.hasValue(),\n 'interactive-disabled': this.disabled,\n 'select-disabled': this.disabled\n });\n }\n render() {\n const { disabled, el, inputId, isExpanded, name, placeholder, value } = this;\n const mode = getIonMode(this);\n const { labelText, labelId } = getAriaLabel(el, inputId);\n renderHiddenInput(true, el, name, parseValue(value), disabled);\n const displayValue = this.getText();\n let addPlaceholderClass = false;\n let selectText = displayValue;\n if (selectText === '' && placeholder != null) {\n selectText = placeholder;\n addPlaceholderClass = true;\n }\n const selectTextClasses = {\n 'select-text': true,\n 'select-placeholder': addPlaceholderClass\n };\n const textPart = addPlaceholderClass ? 'placeholder' : 'text';\n // If there is a label then we need to concatenate it with the\n // current value (or placeholder) and a comma so it separates\n // nicely when the screen reader announces it, otherwise just\n // announce the value / placeholder\n const displayLabel = labelText !== undefined\n ? (selectText !== '' ? `${selectText}, ${labelText}` : labelText)\n : selectText;\n return (h(Host, { onClick: this.onClick, role: \"button\", \"aria-haspopup\": \"listbox\", \"aria-disabled\": disabled ? 'true' : null, \"aria-label\": displayLabel, class: {\n [mode]: true,\n 'in-item': hostContext('ion-item', el),\n 'select-disabled': disabled,\n } }, h(\"div\", { \"aria-hidden\": \"true\", class: selectTextClasses, part: textPart }, selectText), h(\"div\", { class: \"select-icon\", role: \"presentation\", part: \"icon\" }, h(\"div\", { class: \"select-icon-inner\" })), h(\"label\", { id: labelId }, displayLabel), h(\"button\", { type: \"button\", disabled: disabled, id: inputId, \"aria-labelledby\": labelId, \"aria-haspopup\": \"listbox\", \"aria-expanded\": `${isExpanded}`, onFocus: this.onFocus, onBlur: this.onBlur, ref: (focusEl => this.focusEl = focusEl) })));\n }\n get el() { return getElement(this); }\n static get watchers() { return {\n \"disabled\": [\"disabledChanged\"],\n \"placeholder\": [\"disabledChanged\"],\n \"value\": [\"valueChanged\"]\n }; }\n};\nconst isOptionSelected = (currentValue, compareValue, compareWith) => {\n if (currentValue === undefined) {\n return false;\n }\n if (Array.isArray(currentValue)) {\n return currentValue.some(val => compareOptions(val, compareValue, compareWith));\n }\n else {\n return compareOptions(currentValue, compareValue, compareWith);\n }\n};\nconst getOptionValue = (el) => {\n const value = el.value;\n return (value === undefined)\n ? el.textContent || ''\n : value;\n};\nconst parseValue = (value) => {\n if (value == null) {\n return undefined;\n }\n if (Array.isArray(value)) {\n return value.join(',');\n }\n return value.toString();\n};\nconst compareOptions = (currentValue, compareValue, compareWith) => {\n if (typeof compareWith === 'function') {\n return compareWith(currentValue, compareValue);\n }\n else if (typeof compareWith === 'string') {\n return currentValue[compareWith] === compareValue[compareWith];\n }\n else {\n return Array.isArray(compareValue) ? compareValue.includes(currentValue) : currentValue === compareValue;\n }\n};\nconst generateText = (opts, value, compareWith) => {\n if (value === undefined) {\n return '';\n }\n if (Array.isArray(value)) {\n return value\n .map(v => textForValue(opts, v, compareWith))\n .filter(opt => opt !== null)\n .join(', ');\n }\n else {\n return textForValue(opts, value, compareWith) || '';\n }\n};\nconst textForValue = (opts, value, compareWith) => {\n const selectOpt = opts.find(opt => {\n return compareOptions(getOptionValue(opt), value, compareWith);\n });\n return selectOpt\n ? selectOpt.textContent\n : null;\n};\nlet selectIds = 0;\nconst OPTION_CLASS = 'select-interface-option';\nSelect.style = {\n ios: selectIosCss,\n md: selectMdCss\n};\n\nconst selectOptionCss = \":host{display:none}\";\n\nconst SelectOption = class {\n constructor(hostRef) {\n registerInstance(this, hostRef);\n this.inputId = `ion-selopt-${selectOptionIds++}`;\n /**\n * If `true`, the user cannot interact with the select option. This property does not apply when `interface=\"action-sheet\"` as `ion-action-sheet` does not allow for disabled buttons.\n */\n this.disabled = false;\n }\n render() {\n return (h(Host, { role: \"option\", id: this.inputId, class: getIonMode(this) }));\n }\n get el() { return getElement(this); }\n};\nlet selectOptionIds = 0;\nSelectOption.style = selectOptionCss;\n\nconst selectPopoverCss = \".sc-ion-select-popover-h ion-list.sc-ion-select-popover{margin-left:0;margin-right:0;margin-top:-1px;margin-bottom:-1px}.sc-ion-select-popover-h ion-list-header.sc-ion-select-popover,.sc-ion-select-popover-h ion-label.sc-ion-select-popover{margin-left:0;margin-right:0;margin-top:0;margin-bottom:0}\";\n\nconst SelectPopover = class {\n constructor(hostRef) {\n registerInstance(this, hostRef);\n /** Array of options for the popover */\n this.options = [];\n }\n onSelect(ev) {\n const option = this.options.find(o => o.value === ev.target.value);\n if (option) {\n safeCall(option.handler);\n }\n }\n render() {\n const checkedOption = this.options.find(o => o.checked);\n const checkedValue = checkedOption ? checkedOption.value : undefined;\n return (h(Host, { class: getIonMode(this) }, h(\"ion-list\", null, this.header !== undefined && h(\"ion-list-header\", null, this.header), (this.subHeader !== undefined || this.message !== undefined) &&\n h(\"ion-item\", null, h(\"ion-label\", { class: \"ion-text-wrap\" }, this.subHeader !== undefined && h(\"h3\", null, this.subHeader), this.message !== undefined && h(\"p\", null, this.message))), h(\"ion-radio-group\", { value: checkedValue }, this.options.map(option => h(\"ion-item\", { class: getClassMap(option.cssClass) }, h(\"ion-label\", null, option.text), h(\"ion-radio\", { value: option.value, disabled: option.disabled })))))));\n }\n};\nSelectPopover.style = selectPopoverCss;\n\nexport { Select as ion_select, SelectOption as ion_select_option, SelectPopover as ion_select_popover };\n"],"sourceRoot":"webpack:///"} |