solid-panes 5.1.0-2 → 5.1.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (192) hide show
  1. package/README.md +6 -0
  2. package/dist/RDFXMLPane.d.ts.map +1 -1
  3. package/dist/RDFXMLPane2.cjs.js +1 -1
  4. package/dist/RDFXMLPane2.cjs.js.map +1 -1
  5. package/dist/RDFXMLPane2.esm.js +3 -3
  6. package/dist/RDFXMLPane2.esm.js.map +1 -1
  7. package/dist/components/editor-card/EditorCard.cjs.js +2 -2
  8. package/dist/components/editor-card/EditorCard.cjs.js.map +1 -1
  9. package/dist/components/editor-card/EditorCard.d.ts +2 -0
  10. package/dist/components/editor-card/EditorCard.d.ts.map +1 -1
  11. package/dist/components/editor-card/EditorCard.esm.js +68 -43
  12. package/dist/components/editor-card/EditorCard.esm.js.map +1 -1
  13. package/dist/components/editor-card/EditorCard.styles.cjs.js.map +1 -1
  14. package/dist/components/editor-card/EditorCard.styles.esm.js.map +1 -1
  15. package/dist/components/header/Header.cjs.js.map +1 -1
  16. package/dist/components/header/Header.esm.js.map +1 -1
  17. package/dist/components/header/Header.styles.cjs.js.map +1 -1
  18. package/dist/components/header/Header.styles.esm.js.map +1 -1
  19. package/dist/components/navbar/Navbar.cjs.js.map +1 -1
  20. package/dist/components/navbar/Navbar.esm.js.map +1 -1
  21. package/dist/components/navbar/Navbar.styles.cjs.js.map +1 -1
  22. package/dist/components/navbar/Navbar.styles.esm.js.map +1 -1
  23. package/dist/components/profile-heading/ProfileHeading.cjs.js +6 -6
  24. package/dist/components/profile-heading/ProfileHeading.cjs.js.map +1 -1
  25. package/dist/components/profile-heading/ProfileHeading.d.ts +4 -0
  26. package/dist/components/profile-heading/ProfileHeading.d.ts.map +1 -1
  27. package/dist/components/profile-heading/ProfileHeading.esm.js +123 -107
  28. package/dist/components/profile-heading/ProfileHeading.esm.js.map +1 -1
  29. package/dist/components/profile-heading/ProfileHeading.styles.cjs.js +1 -1
  30. package/dist/components/profile-heading/ProfileHeading.styles.cjs.js.map +1 -1
  31. package/dist/components/profile-heading/ProfileHeading.styles.esm.js +1 -1
  32. package/dist/components/profile-heading/ProfileHeading.styles.esm.js.map +1 -1
  33. package/dist/components/profile-heading/editor/sections/heading/HeadingEditDialog.cjs.js +19 -19
  34. package/dist/components/profile-heading/editor/sections/heading/HeadingEditDialog.cjs.js.map +1 -1
  35. package/dist/components/profile-heading/editor/sections/heading/HeadingEditDialog.esm.js +86 -86
  36. package/dist/components/profile-heading/editor/sections/heading/HeadingEditDialog.esm.js.map +1 -1
  37. package/dist/components/profile-heading/editor/sections/heading/dateHelpers.cjs.js.map +1 -1
  38. package/dist/components/profile-heading/editor/sections/heading/dateHelpers.esm.js.map +1 -1
  39. package/dist/components/profile-heading/editor/sections/heading/imageHelpers.cjs.js.map +1 -1
  40. package/dist/components/profile-heading/editor/sections/heading/imagePreview.cjs.js.map +1 -1
  41. package/dist/components/profile-heading/editor/sections/heading/mutations.cjs.js +1 -1
  42. package/dist/components/profile-heading/editor/sections/heading/mutations.cjs.js.map +1 -1
  43. package/dist/components/profile-heading/editor/sections/heading/mutations.esm.js +61 -61
  44. package/dist/components/profile-heading/editor/sections/shared/contactTypeUtils.cjs.js.map +1 -1
  45. package/dist/components/profile-heading/editor/sections/shared/contactTypeUtils.esm.js.map +1 -1
  46. package/dist/components/profile-heading/editor/sections/shared/idNodeFactory.cjs.js.map +1 -1
  47. package/dist/components/profile-heading/editor/sections/shared/phoneCountries.cjs.js.map +1 -1
  48. package/dist/components/profile-heading/editor/sections/shared/phoneCountries.esm.js.map +1 -1
  49. package/dist/components/profile-heading/editor/sections/shared/rdfMutationHelpers.cjs.js.map +1 -1
  50. package/dist/components/profile-heading/editor/sections/shared/rdfMutationHelpers.esm.js.map +1 -1
  51. package/dist/components/profile-heading/editor/sections/shared/rowState.cjs.js.map +1 -1
  52. package/dist/components/profile-heading/editor/sections/shared/rowState.esm.js.map +1 -1
  53. package/dist/components/profile-heading/editor/sections/shared/sanitizeUtils.cjs.js.map +1 -1
  54. package/dist/components/profile-heading/editor/textUtils.cjs.js.map +1 -1
  55. package/dist/components/profile-heading/editor/textUtils.esm.js.map +1 -1
  56. package/dist/components/profile-heading/editor/texts/dialogTexts.cjs.js.map +1 -1
  57. package/dist/components/profile-heading/editor/texts/dialogTexts.esm.js.map +1 -1
  58. package/dist/components/profile-heading/editor/texts/messageTexts.cjs.js.map +1 -1
  59. package/dist/components/profile-heading/editor/texts/messageTexts.esm.js.map +1 -1
  60. package/dist/components/profile-heading/editor/ui/dialog2.cjs.js +1 -1
  61. package/dist/components/profile-heading/editor/ui/dialog2.cjs.js.map +1 -1
  62. package/dist/components/profile-heading/editor/ui/dialog2.esm.js +1 -1
  63. package/dist/components/profile-heading/editor/ui/dialog2.esm.js.map +1 -1
  64. package/dist/components/profile-heading/friendActions.cjs.js +1 -1
  65. package/dist/components/profile-heading/friendActions.cjs.js.map +1 -1
  66. package/dist/components/profile-heading/friendActions.esm.js +5 -5
  67. package/dist/components/profile-heading/profileHeadingData.cjs.js.map +1 -1
  68. package/dist/components/resource-action-dialog/ResourceActionDialog.cjs.js +33 -0
  69. package/dist/components/resource-action-dialog/ResourceActionDialog.cjs.js.map +1 -0
  70. package/dist/components/resource-action-dialog/ResourceActionDialog.d.ts +16 -0
  71. package/dist/components/resource-action-dialog/ResourceActionDialog.d.ts.map +1 -0
  72. package/dist/components/resource-action-dialog/ResourceActionDialog.esm.js +309 -0
  73. package/dist/components/resource-action-dialog/ResourceActionDialog.esm.js.map +1 -0
  74. package/dist/components/resource-action-dialog/ResourceActionDialog.styles.cjs.js +2 -0
  75. package/dist/components/resource-action-dialog/ResourceActionDialog.styles.cjs.js.map +1 -0
  76. package/dist/components/resource-action-dialog/ResourceActionDialog.styles.esm.js +6 -0
  77. package/dist/components/resource-action-dialog/ResourceActionDialog.styles.esm.js.map +1 -0
  78. package/dist/dataContentPane.d.ts.map +1 -1
  79. package/dist/dataContentPane2.cjs.js +1 -1
  80. package/dist/dataContentPane2.cjs.js.map +1 -1
  81. package/dist/dataContentPane2.esm.js +90 -78
  82. package/dist/dataContentPane2.esm.js.map +1 -1
  83. package/dist/humanReadablePane.d.ts +1 -0
  84. package/dist/humanReadablePane.d.ts.map +1 -1
  85. package/dist/humanReadablePane2.cjs.js +147 -15
  86. package/dist/humanReadablePane2.cjs.js.map +1 -1
  87. package/dist/humanReadablePane2.esm.js +281 -114
  88. package/dist/humanReadablePane2.esm.js.map +1 -1
  89. package/dist/imagePane.d.ts.map +1 -1
  90. package/dist/imagePane2.cjs.js +1 -1
  91. package/dist/imagePane2.cjs.js.map +1 -1
  92. package/dist/imagePane2.esm.js +9 -7
  93. package/dist/imagePane2.esm.js.map +1 -1
  94. package/dist/index.cjs.js +1 -1
  95. package/dist/index.cjs.js.map +1 -1
  96. package/dist/index.d.ts +1 -0
  97. package/dist/index.d.ts.map +1 -1
  98. package/dist/index.esm.js +16 -15
  99. package/dist/index.esm.js.map +1 -1
  100. package/dist/internal/internalPane.d.ts.map +1 -1
  101. package/dist/internal/internalPane2.cjs.js +1 -1
  102. package/dist/internal/internalPane2.cjs.js.map +1 -1
  103. package/dist/internal/internalPane2.esm.js +55 -60
  104. package/dist/internal/internalPane2.esm.js.map +1 -1
  105. package/dist/mainPage/header.cjs.js +1 -1
  106. package/dist/mainPage/header.esm.js +2 -2
  107. package/dist/mainPage/index.cjs.js +1 -1
  108. package/dist/mainPage/index.cjs.js.map +1 -1
  109. package/dist/mainPage/index.d.ts.map +1 -1
  110. package/dist/mainPage/index.esm.js +44 -24
  111. package/dist/mainPage/index.esm.js.map +1 -1
  112. package/dist/mainPage/navbar.cjs.js +1 -1
  113. package/dist/mainPage/navbar.cjs.js.map +1 -1
  114. package/dist/mainPage/navbar.esm.js +15 -15
  115. package/dist/mainPage/navigation.cjs.js +1 -1
  116. package/dist/mainPage/navigation.cjs.js.map +1 -1
  117. package/dist/mainPage/navigation.esm.js +4 -4
  118. package/dist/mainPage/profileHeading.d.ts +2 -1
  119. package/dist/mainPage/profileHeading.d.ts.map +1 -1
  120. package/dist/mainPage/profileHeading2.cjs.js +1 -1
  121. package/dist/mainPage/profileHeading2.cjs.js.map +1 -1
  122. package/dist/mainPage/profileHeading2.esm.js +76 -76
  123. package/dist/mainPage/profileHeading2.esm.js.map +1 -1
  124. package/dist/n3Pane.d.ts.map +1 -1
  125. package/dist/n3Pane2.cjs.js +1 -1
  126. package/dist/n3Pane2.cjs.js.map +1 -1
  127. package/dist/n3Pane2.esm.js +1 -1
  128. package/dist/n3Pane2.esm.js.map +1 -1
  129. package/dist/navigation/browserEvents.cjs.js +1 -1
  130. package/dist/navigation/browserEvents.cjs.js.map +1 -1
  131. package/dist/navigation/browserEvents.d.ts.map +1 -1
  132. package/dist/navigation/browserEvents.esm.js +17 -17
  133. package/dist/navigation/browserEvents.esm.js.map +1 -1
  134. package/dist/navigation/chrome.cjs.js +1 -1
  135. package/dist/navigation/chrome.cjs.js.map +1 -1
  136. package/dist/navigation/chrome.d.ts +20 -2
  137. package/dist/navigation/chrome.d.ts.map +1 -1
  138. package/dist/navigation/chrome.esm.js +14 -8
  139. package/dist/navigation/chrome.esm.js.map +1 -1
  140. package/dist/navigation/controller.cjs.js +1 -1
  141. package/dist/navigation/controller.cjs.js.map +1 -1
  142. package/dist/navigation/controller.d.ts +3 -0
  143. package/dist/navigation/controller.d.ts.map +1 -1
  144. package/dist/navigation/controller.esm.js +50 -29
  145. package/dist/navigation/controller.esm.js.map +1 -1
  146. package/dist/navigation/options.cjs.js +1 -1
  147. package/dist/navigation/options.cjs.js.map +1 -1
  148. package/dist/navigation/options.d.ts +12 -0
  149. package/dist/navigation/options.d.ts.map +1 -1
  150. package/dist/navigation/options.esm.js +4 -1
  151. package/dist/navigation/options.esm.js.map +1 -1
  152. package/dist/navigation/podContext.cjs.js +1 -1
  153. package/dist/navigation/podContext.cjs.js.map +1 -1
  154. package/dist/navigation/podContext.d.ts.map +1 -1
  155. package/dist/navigation/podContext.esm.js +17 -17
  156. package/dist/navigation/podContext.esm.js.map +1 -1
  157. package/dist/navigation/state.cjs.js +1 -1
  158. package/dist/navigation/state.cjs.js.map +1 -1
  159. package/dist/navigation/state.d.ts +4 -0
  160. package/dist/navigation/state.d.ts.map +1 -1
  161. package/dist/navigation/state.esm.js +18 -5
  162. package/dist/navigation/state.esm.js.map +1 -1
  163. package/dist/outline/fileExplorerHelpers.cjs.js +1 -1
  164. package/dist/outline/fileExplorerHelpers.cjs.js.map +1 -1
  165. package/dist/outline/fileExplorerHelpers.d.ts +2 -5
  166. package/dist/outline/fileExplorerHelpers.d.ts.map +1 -1
  167. package/dist/outline/fileExplorerHelpers.esm.js +11 -13
  168. package/dist/outline/fileExplorerHelpers.esm.js.map +1 -1
  169. package/dist/outline/manager2.cjs.js +1 -1
  170. package/dist/outline/manager2.cjs.js.map +1 -1
  171. package/dist/outline/manager2.esm.js +355 -296
  172. package/dist/outline/manager2.esm.js.map +1 -1
  173. package/dist/registerPanes.cjs.js +1 -1
  174. package/dist/registerPanes.cjs.js.map +1 -1
  175. package/dist/registerPanes.esm.js +1 -1
  176. package/dist/registerPanes.esm.js.map +1 -1
  177. package/dist/slideshow/slideshowPane.cjs.js +1 -1
  178. package/dist/slideshow/slideshowPane.cjs.js.map +1 -1
  179. package/dist/slideshow/slideshowPane.esm.js +30 -30
  180. package/dist/slideshow/slideshowPane.esm.js.map +1 -1
  181. package/dist/social/socialPane2.cjs.js +1 -1
  182. package/dist/social/socialPane2.esm.js +1 -1
  183. package/dist/social/socialSections.cjs.js +1 -1
  184. package/dist/social/socialSections.esm.js +1 -1
  185. package/dist/utils/paneUtils.cjs.js +1 -1
  186. package/dist/utils/paneUtils.cjs.js.map +1 -1
  187. package/dist/utils/paneUtils.esm.js +15 -15
  188. package/dist/versionInfo.cjs.js +1 -1
  189. package/dist/versionInfo.cjs.js.map +1 -1
  190. package/dist/versionInfo.esm.js +9 -9
  191. package/dist/versionInfo.esm.js.map +1 -1
  192. package/package.json +11 -12
@@ -1 +1 @@
1
- {"version":3,"file":"HeadingEditDialog.cjs.js","names":["openInputDialog","html","render","Image","processHeadingMutations","combinePhoneValue","splitPhoneValue","normalizeEmailTypeForEdit","normalizePhoneTypeForEdit","toSavedHeadingEmailType","toSavedHeadingPhoneType","applyRowFieldChange","applyRowSelectChange","summarizeRowOps","hasNonEmptyText","sanitizeTextValue","toText","toTypeLabel","dialogCancelLabelText","dialogSubmitLabelText","editHeadingDialogTitleText","ownerLoginRequiredDialogMessageText","saveHeadingUpdatesFailedMessageText","sanitizeAddressFieldValue","sanitizeBasicInputFieldValue","sanitizeEmailValue","sanitizePhoneLocalValue","toStorageDateISO","invalidateResolvedPhotoDisplaySrc","resolvePhotoDisplaySrc","uploadPhotoFile","HEADING_PHONE_TYPE_OPTIONS","label","value","HEADING_EMAIL_TYPE_OPTIONS","HEADING_PRONOUN_OPTIONS","isContactPointRow","row","isAddressRow","isProfileBasicRow","normalizeHeadingContactTypeValue","options","some","option","getHeadingContactTypeOptions","kind","withDefaultHeadingContactType","type","rowHasContent","streetAddress","locality","region","postalCode","countryName","name","nickname","imageSrc","location","pronouns","dateOfBirth","normalizePronounsValue","normalized","toLowerCase","replace","toFormState","profileData","basicInfo","entryNode","status","primaryEmail","primaryPhone","primaryAddress","emailTypeWasMissing","phoneTypeWasMissing","normalizedEmailType","normalizedPhoneType","email","valueNode","phone","address","imagePreviewSrc","clearImagePreview","undefined","setHeadingImagePreview","formState","file","URL","createObjectURL","previewUrl","revokeObjectURL","setResolvedHeadingPreview","resolvedImageSrc","mapEmailOpsForSave","ops","mapRow","create","map","update","remove","mapPhoneOpsForSave","summarizeHeadingContactOps","typeWasMissing","length","renderContactPhoneInput","typeLabel","inputName","splitValue","selectedDialCode","dialCode","handleValueInput","e","target","nextValue","handleTypeInput","event","detail","nextType","String","localNumber","renderContactEmailInputRow","renderContactAddressInput","streetAddressName","localityName","regionName","postalCodeName","handleAddressInput","field","renderHeadingInfoInput","rerender","imageSrcLabel","recommendedImageToLoad","nameLabel","nicknameLabel","pronounsLabel","dateOfBirthLabel","handleBasicInfoInput","handleDateOfBirthInput","handlePronounsInput","handleUpload","button","currentTarget","dom","ownerDocument","document","fileInput","createElement","accept","hidden","cleanupFileInput","addEventListener","files","pendingImageFile","error","console","once","body","appendChild","click","handleCameraInput","handleDelete","renderHeadingEditTemplate","form","viewerMode","createHeadingEditForm","classList","add","autocomplete","setAttribute","isValidHeadingEmailAddress","test","isValidHeadingPhoneNumber","validateHeadingDataBeforeSave","createHeadingEditDialog","_event","store","subject","onSaved","originalPhotoUri","result","title","headerAction","submitLabel","cancelLabel","shouldCloseWithoutSave","basicInfoOps","phoneOps","emailOps","addressOps","validate","onSave","uploadedUri","plan","basicOps","nextPhotoUri","warn","formatSaveError","Error","message","hasNonEmptyText","sanitizeTextValue","toText","normalizeEmailTypeForEdit","normalizePhoneTypeForEdit","sanitizeEmailValue","sanitizeAddressFieldValue","toTypeLabel","toSavedHeadingEmailType","toSavedHeadingPhoneType","summarizeRowOps","splitPhoneValue","sanitizePhoneLocalValue","combinePhoneValue","sanitizeBasicInputFieldValue","toStorageDateISO","Image","ownerLoginRequiredDialogMessageText","resolvePhotoDisplaySrc","openInputDialog","uploadPhotoFile","processHeadingMutations","require_dialog","require_imagePreview","require_messageTexts","require_mutations","require_phoneCountries","require_textUtils","require_contactTypeUtils","require_rowState","require_sanitizeUtils","require_dateHelpers","require_imageHelpers","lit_html","HEADING_PHONE_TYPE_OPTIONS","HEADING_EMAIL_TYPE_OPTIONS","HEADING_PRONOUN_OPTIONS","isContactPointRow","row","isAddressRow","isProfileBasicRow","normalizeHeadingContactTypeValue","options","option","value","getHeadingContactTypeOptions","kind","withDefaultHeadingContactType","rowHasContent","normalizePronounsValue","normalized","toFormState","basicInfo","profileData","primaryEmail","primaryPhone","primaryAddress","emailTypeWasMissing","phoneTypeWasMissing","normalizedEmailType","normalizedPhoneType","email","phone","address","setHeadingImagePreview","formState","previewUrl","file","setResolvedHeadingPreview","resolvedImageSrc","mapEmailOpsForSave","mapRow","ops","mapPhoneOpsForSave","summarizeHeadingContactOps","typeWasMissing","renderContactPhoneInput","label","typeLabel","inputName","splitValue","selectedDialCode","target","e","nextValue","event","nextType","renderContactEmailInputRow","renderContactAddressInput","handleAddressInput","field","renderHeadingInfoInput","nameLabel","nicknameLabel","pronounsLabel","handleBasicInfoInput","imagePreviewSrc","rerender","error","dom","fileInput","cleanupFileInput","renderHeadingEditTemplate","form","viewerMode","createHeadingEditForm","isValidHeadingEmailAddress","isValidHeadingPhoneNumber","validateHeadingDataBeforeSave","localNumber","createHeadingEditDialog","originalPhotoUri","store","basicInfoOps","phoneOps","emailOps","addressOps","uploadedUri","subject","plan","nextPhotoUri","onSaved"],"sources":["../../../../../../src/components/profile-heading/editor/sections/heading/HeadingEditDialog.ts"],"sourcesContent":["import { openInputDialog } from '../../ui/dialog'\nimport { html, render, TemplateResult } from 'lit-html'\nimport 'solid-ui/components/button'\nimport 'solid-ui/components/combobox'\nimport 'solid-ui/components/combobox-option'\nimport { type ComboboxChangeEvent } from 'solid-ui/components/combobox'\nimport 'solid-ui/components/photo-capture'\nimport type { PhotoCapture } from 'solid-ui/components/photo-capture'\nimport { ProfileDetails, HeadingMutationPlan, ProfileBasicRow } from './types'\nimport { Image } from './imagePreview'\nimport '../../styles/EditDialogs.css'\nimport { LiveStore, NamedNode } from 'rdflib'\nimport { processHeadingMutations } from './mutations'\nimport { ViewerMode } from '../../../../../types'\nimport {\n combinePhoneValue,\n splitPhoneValue\n} from '../shared/phoneCountries'\nimport {\n normalizeEmailTypeForEdit,\n normalizePhoneTypeForEdit,\n toSavedHeadingEmailType,\n toSavedHeadingPhoneType\n} from '../shared/contactTypeUtils'\nimport { applyRowFieldChange, applyRowSelectChange, summarizeRowOps } from '../shared/rowState'\nimport { hasNonEmptyText, sanitizeTextValue, toText, toTypeLabel } from '../../textUtils'\nimport {\n dialogCancelLabelText,\n dialogSubmitLabelText,\n editHeadingDialogTitleText,\n ownerLoginRequiredDialogMessageText,\n saveHeadingUpdatesFailedMessageText\n} from '../../texts'\nimport '~icons/lucide/camera'\nimport { ContactAddressRow, ContactPointRow } from '../contactInfo/types'\nimport { sanitizeAddressFieldValue, sanitizeBasicInputFieldValue, sanitizeEmailValue, sanitizePhoneLocalValue } from '../shared/sanitizeUtils'\nimport { toStorageDateISO } from './dateHelpers'\nimport { invalidateResolvedPhotoDisplaySrc, resolvePhotoDisplaySrc, uploadPhotoFile } from './imageHelpers'\n/* Note: new design - has address type in More Edit Contacts for now we will leave\n out Address Type, but a ticket will be created to add type later\n so I will keep the code and just comment it out for now.\n new design - has country code, will comment out code for now and create a ticket to add later. */\n\ntype HeadingFormState = {\n basicInfo: ProfileBasicRow\n email: ContactPointRow\n phone: ContactPointRow\n address: ContactAddressRow\n emailTypeWasMissing: boolean\n phoneTypeWasMissing: boolean\n pendingImageFile?: File | null\n imagePreviewSrc: string\n clearImagePreview: () => void\n}\n\ntype HeadingContactTypeOption = {\n label: string\n value: string\n}\n\ntype HeadingPronounsOption = {\n label: string\n value: string\n}\n\ntype HeadingContactTypeKind = 'phone' | 'email'\n\nconst HEADING_PHONE_TYPE_OPTIONS: HeadingContactTypeOption[] = [\n { label: 'Mobile', value: 'Mobile' },\n { label: 'Home', value: 'Home' },\n { label: 'Work', value: 'Work' }\n]\n\nconst HEADING_EMAIL_TYPE_OPTIONS: HeadingContactTypeOption[] = [\n { label: 'Personal', value: 'Personal' },\n { label: 'Office', value: 'Office' }\n]\n\nconst HEADING_PRONOUN_OPTIONS: HeadingPronounsOption[] = [\n { label: 'He/Him', value: 'He/Him' },\n { label: 'She/Her', value: 'She/Her' },\n { label: 'They/Them', value: 'They/Them' }\n]\n\ntype Row = ProfileBasicRow | ContactPointRow | ContactAddressRow\n\nfunction isContactPointRow (row: Row): row is ContactPointRow {\n return 'value' in row\n}\n\nfunction isAddressRow (row: Row): row is ContactAddressRow {\n return 'streetAddress' in row\n}\n\nfunction isProfileBasicRow (row: Row): row is ProfileBasicRow {\n return 'name' in row\n}\n\nfunction normalizeHeadingContactTypeValue (value: string, options: HeadingContactTypeOption[]): string {\n return options.some((option) => option.value === value) ? value : options[0]?.value || ''\n}\n\nfunction getHeadingContactTypeOptions (kind: HeadingContactTypeKind): HeadingContactTypeOption[] {\n return kind === 'phone' ? HEADING_PHONE_TYPE_OPTIONS : HEADING_EMAIL_TYPE_OPTIONS\n}\n\nfunction withDefaultHeadingContactType (\n row: ContactPointRow,\n kind: HeadingContactTypeKind\n): ContactPointRow {\n return {\n ...row,\n type: normalizeHeadingContactTypeValue(row.type || '', getHeadingContactTypeOptions(kind))\n }\n}\n\nfunction rowHasContent (row: Row): boolean {\n if (isContactPointRow(row)) {\n return hasNonEmptyText(row.value)\n }\n if (isAddressRow(row)) {\n return [\n row.streetAddress,\n row.locality,\n row.region,\n row.postalCode,\n row.countryName\n ].some(hasNonEmptyText)\n }\n if (isProfileBasicRow(row)) {\n return [\n row.name,\n row.nickname,\n row.imageSrc,\n row.location,\n row.pronouns,\n row.dateOfBirth\n ].some(hasNonEmptyText)\n }\n return false\n}\n\nfunction normalizePronounsValue (value: string | undefined): string {\n const normalized = sanitizeTextValue(value || '').toLowerCase().replace(/\\s+/g, '')\n if (!normalized) return ''\n if (normalized === 'he' || normalized === 'he/him') return 'He/Him'\n if (normalized === 'she' || normalized === 'she/her') return 'She/Her'\n if (normalized === 'they' || normalized === 'they/them') return 'They/Them'\n return value || ''\n}\n\nfunction toFormState (profileData: ProfileDetails): HeadingFormState {\n const basicInfo: ProfileBasicRow = {\n name: sanitizeTextValue(toText(profileData.name)),\n nickname: sanitizeTextValue(toText(profileData.nickname || '')),\n imageSrc: sanitizeTextValue(toText(profileData.imageSrc || '')),\n location: sanitizeTextValue(toText(profileData.location || '')),\n pronouns: normalizePronounsValue(toText(profileData.pronouns || '')),\n dateOfBirth: sanitizeTextValue(toText(profileData.dateOfBirth || '')),\n entryNode: toText(profileData.entryNode),\n status: toText(profileData.entryNode) ? 'existing' as const : 'new' as const\n }\n const primaryEmail = profileData.primaryEmail\n const primaryPhone = profileData.primaryPhone\n const primaryAddress = profileData.primaryAddress\n const emailTypeWasMissing = !normalizeEmailTypeForEdit(primaryEmail?.type)\n const phoneTypeWasMissing = !normalizePhoneTypeForEdit(primaryPhone?.type)\n\n const normalizedEmailType = normalizeEmailTypeForEdit(primaryEmail?.type)\n const normalizedPhoneType = normalizePhoneTypeForEdit(primaryPhone?.type)\n\n const email: ContactPointRow = {\n value: sanitizeEmailValue(toText(primaryEmail?.valueNode).replace(/^mailto:/i, '')),\n type: normalizedEmailType,\n entryNode: toText(primaryEmail?.entryNode),\n status: toText(primaryEmail?.entryNode) ? 'existing' as const : 'new' as const\n }\n const phone: ContactPointRow = {\n value: sanitizeTextValue(\n toText(primaryPhone?.valueNode || primaryPhone?.entryNode || '').replace(/^tel:/i, '')\n ),\n type: normalizedPhoneType,\n entryNode: toText(primaryPhone?.entryNode || ''),\n status: toText(primaryPhone?.entryNode || '') ? 'existing' as const : 'new' as const\n }\n const address: ContactAddressRow = {\n streetAddress: sanitizeAddressFieldValue(toText(primaryAddress?.streetAddress)),\n locality: sanitizeAddressFieldValue(toText(primaryAddress?.locality)),\n region: sanitizeAddressFieldValue(toText(primaryAddress?.region)),\n postalCode: sanitizeAddressFieldValue(toText(primaryAddress?.postalCode)),\n countryName: sanitizeAddressFieldValue(toText(primaryAddress?.countryName)),\n type: toTypeLabel(primaryAddress?.type),\n entryNode: toText(primaryAddress?.entryNode),\n status: toText(primaryAddress?.entryNode) ? 'existing' as const : 'new' as const\n }\n\n return {\n basicInfo: (basicInfo) || { name: '', nickname: '', imageSrc: '', location: '', pronouns: '', dateOfBirth: '', entryNode: '', status: 'new' },\n email: (email) || { value: '', type: '', entryNode: '', status: 'new' },\n phone: (phone) || { value: '', type: '', entryNode: '', status: 'new' },\n address: (address) || { streetAddress: '', locality: '', region: '', postalCode: '', countryName: '', type: '', entryNode: '', status: 'new' },\n emailTypeWasMissing,\n phoneTypeWasMissing,\n imagePreviewSrc: '',\n clearImagePreview: () => undefined\n }\n}\n\nfunction setHeadingImagePreview (formState: HeadingFormState, file: File) {\n formState.clearImagePreview()\n\n if (typeof URL.createObjectURL !== 'function') {\n formState.imagePreviewSrc = ''\n formState.clearImagePreview = () => undefined\n return\n }\n\n const previewUrl = URL.createObjectURL(file)\n formState.imagePreviewSrc = previewUrl\n formState.clearImagePreview = () => {\n URL.revokeObjectURL(previewUrl)\n formState.imagePreviewSrc = ''\n formState.clearImagePreview = () => undefined\n }\n}\n\nfunction setResolvedHeadingPreview (formState: HeadingFormState, resolvedImageSrc?: string) {\n formState.clearImagePreview()\n\n if (!resolvedImageSrc) {\n return\n }\n\n formState.imagePreviewSrc = resolvedImageSrc\n\n formState.clearImagePreview = () => {\n formState.imagePreviewSrc = ''\n formState.clearImagePreview = () => undefined\n }\n}\n\ntype ProfileBasicEditableField =\n | 'name'\n | 'nickname'\n | 'imageSrc'\n | 'pronouns'\n | 'dateOfBirth'\n\ntype ContactAddressEditableField =\n | 'streetAddress'\n | 'locality'\n | 'region'\n | 'postalCode'\n | 'countryName'\n\ntype ContactPhoneInputRowProps = {\n phone: ContactPointRow\n}\n\ntype ContactEmailInputRowProps = {\n email: ContactPointRow\n}\n\ntype ContactAddressInputRowProps = {\n address: ContactAddressRow\n}\n\nfunction mapEmailOpsForSave (ops: { create: ContactPointRow[], update: ContactPointRow[], remove: ContactPointRow[] }) {\n const mapRow = (row: ContactPointRow): ContactPointRow => ({\n ...withDefaultHeadingContactType(row, 'email'),\n type: toSavedHeadingEmailType(withDefaultHeadingContactType(row, 'email').type)\n })\n\n return {\n create: ops.create.map(mapRow),\n update: ops.update.map(mapRow),\n remove: ops.remove.map(mapRow)\n }\n}\n\nfunction mapPhoneOpsForSave (ops: { create: ContactPointRow[], update: ContactPointRow[], remove: ContactPointRow[] }) {\n const mapRow = (row: ContactPointRow): ContactPointRow => ({\n ...withDefaultHeadingContactType(row, 'phone'),\n type: toSavedHeadingPhoneType(withDefaultHeadingContactType(row, 'phone').type)\n })\n\n return {\n create: ops.create.map(mapRow),\n update: ops.update.map(mapRow),\n remove: ops.remove.map(mapRow)\n }\n}\n\nfunction summarizeHeadingContactOps (\n row: ContactPointRow,\n kind: HeadingContactTypeKind,\n typeWasMissing: boolean\n) {\n const ops = summarizeRowOps([row], rowHasContent)\n\n if (\n typeWasMissing &&\n row.entryNode &&\n row.status === 'existing' &&\n rowHasContent(row) &&\n ops.create.length === 0 &&\n ops.update.length === 0 &&\n ops.remove.length === 0\n ) {\n return {\n create: ops.create,\n update: [withDefaultHeadingContactType({ ...row, status: 'modified' }, kind)],\n remove: ops.remove\n }\n }\n\n return ops\n}\n\nfunction renderContactPhoneInput ({\n phone\n}: ContactPhoneInputRowProps) {\n const label = 'Mobile Number'\n const typeLabel = 'Phone Type 1'\n const inputName = 'phone-value'\n const splitValue = splitPhoneValue(phone?.value || '')\n const selectedDialCode = splitValue.dialCode\n\n const handleValueInput = (e: Event) => {\n const target = e.target as HTMLInputElement\n const nextValue = sanitizePhoneLocalValue(target.value)\n if (phone) {\n applyRowFieldChange(phone, 'value', combinePhoneValue(selectedDialCode, nextValue), rowHasContent)\n }\n }\n\n const handleTypeInput = (e: Event) => {\n const event = e as ComboboxChangeEvent\n if (!event.detail.option) return\n const nextType = String(event.detail.option.value)\n if (phone) {\n applyRowSelectChange(phone, 'type', nextType)\n }\n }\n\n return html`\n <div class=\"profile-edit-dialog__row profile-edit-dialog__row--equal profile-edit-dialog__row--contact-point\">\n <div class=\"profile-edit-dialog__field\">\n <label aria-label=${label} class=\"label\">\n ${label}\n <input\n class=\"input\"\n type=\"tel\"\n name=${inputName}\n .value=${splitValue.localNumber}\n required\n data-contact-field=\"value\"\n data-entry-node=${phone?.entryNode || ''}\n data-row-status=${phone?.status || 'n/a'}\n placeholder=${label}\n autocomplete=\"tel-national\"\n inputmode=\"tel\"\n @input=${handleValueInput}\n />\n </label>\n </div>\n <label aria-label=${typeLabel} class=\"label profile-edit-dialog__field-type profile-edit-dialog__field-type--contact-point\">\n <solid-ui-combobox\n select-only\n class=\"profile-edit-dialog__type-select\"\n id=${`phone-type-select-${inputName}`}\n aria-label=${typeLabel}\n .value=${normalizeHeadingContactTypeValue(phone?.type || '', HEADING_PHONE_TYPE_OPTIONS)}\n @change=${handleTypeInput}\n >\n ${HEADING_PHONE_TYPE_OPTIONS.map((option) => html`<solid-ui-combobox-option value=${option.value}>${option.label}</solid-ui-combobox-option>`)}\n </solid-ui-combobox>\n </label>\n </div>\n `\n}\n\nfunction renderContactEmailInputRow ({\n email\n}: ContactEmailInputRowProps) {\n const label = 'Email'\n const typeLabel = 'Email Type'\n const inputName = 'email-value'\n\n const handleValueInput = (e: Event) => {\n const target = e.target as HTMLInputElement\n const nextValue = sanitizeEmailValue(target.value)\n if (email) {\n applyRowFieldChange(email, 'value', nextValue, rowHasContent)\n }\n }\n\n const handleTypeInput = (e: Event) => {\n const event = e as ComboboxChangeEvent\n if (!event.detail.option) return\n const nextType = String(event.detail.option.value)\n if (email) {\n applyRowSelectChange(email, 'type', nextType)\n }\n }\n\n return html`\n <div class=\"profile-edit-dialog__row profile-edit-dialog__row--equal profile-edit-dialog__row--contact-point\">\n <label aria-label=${label} class=\"label profile-edit-dialog__field\">\n ${label}\n <input\n class=\"input\"\n type=\"email\"\n name=${inputName}\n .value=${email?.value || ''}\n required\n data-contact-field=\"value\"\n data-entry-node=${email?.entryNode || ''}\n data-row-status=${email?.status || 'n/a'}\n placeholder=\"Email Address\"\n autocomplete=\"email\"\n inputmode=\"email\"\n @input=${handleValueInput}\n />\n </label>\n <label aria-label=${typeLabel} class=\"label profile-edit-dialog__field-type profile-edit-dialog__field-type--contact-point\">\n <solid-ui-combobox\n select-only\n class=\"profile-edit-dialog__type-select\"\n id=${`email-type-select-${inputName}`}\n aria-label=${typeLabel}\n .value=${normalizeHeadingContactTypeValue(email?.type || '', HEADING_EMAIL_TYPE_OPTIONS)}\n @change=${handleTypeInput}\n >\n ${HEADING_EMAIL_TYPE_OPTIONS.map((option) => html`<solid-ui-combobox-option value=${option.value}>${option.label}</solid-ui-combobox-option>`)}\n </solid-ui-combobox>\n </label>\n </div>\n `\n}\n\nfunction renderContactAddressInput ({\n address\n}: ContactAddressInputRowProps) {\n const label = 'Address'\n /* const typeLabel = 'Address Type' */\n /* const typeInputName = 'address-type' */\n /* const addressTypeSelectId = 'address-type-select' */\n const streetAddressName = 'address-street'\n const localityName = 'address-locality'\n const regionName = 'address-region'\n const postalCodeName = 'address-postal'\n const countryName = 'address-country'\n\n const handleAddressInput = (field: ContactAddressEditableField) => (e: Event) => {\n const target = e.target as HTMLInputElement\n const nextValue = sanitizeAddressFieldValue(target.value)\n if (address) {\n applyRowFieldChange(address, field, nextValue, rowHasContent)\n }\n }\n\n /* const handleTypeInput = (e: Event) => {\n const target = e.target as HTMLInputElement\n const nextType = target.value\n if (address) {\n applyRowSelectChange(address, 'type', nextType)\n }\n } */\n\n return html`\n <label aria-label=${`${label} Street`} class=\"label profile-edit-dialog__field profile-edit-dialog__field--row-width\">\n Street Address\n <input\n class=\"input\"\n type=\"text\"\n name=${streetAddressName}\n .value=${address?.streetAddress || ''}\n required\n data-contact-field=\"streetAddress\"\n data-entry-node=${address?.entryNode || ''}\n data-row-status=${address?.status || 'n/a'}\n placeholder=\"Street Address\"\n autocomplete=\"street-address\"\n inputmode=\"text\"\n @change=${handleAddressInput('streetAddress')}\n />\n </label>\n\n <div class=\"profile-edit-dialog__row profile-edit-dialog__row--equal profile-edit-dialog__row--full\">\n <label aria-label=${`${label} Locality`} class=\"label profile-edit-dialog__field\">\n Locality\n <input\n class=\"input\"\n type=\"text\"\n name=${localityName}\n .value=${address?.locality || ''}\n data-contact-field=\"locality\"\n data-entry-node=${address?.entryNode || ''}\n data-row-status=${address?.status || 'n/a'}\n placeholder=\"City / Locality\"\n autocomplete=\"address-level2\"\n inputmode=\"text\"\n @change=${handleAddressInput('locality')}\n />\n </label>\n <label aria-label=${`${label} Postal Code`} class=\"label profile-edit-dialog__field\">\n Postal Code\n <input\n class=\"input\"\n type=\"text\"\n name=${postalCodeName}\n .value=${address?.postalCode || ''}\n data-contact-field=\"postalCode\"\n data-entry-node=${address?.entryNode || ''}\n data-row-status=${address?.status || 'n/a'}\n placeholder=\"Postal Code\"\n autocomplete=\"postal-code\"\n inputmode=\"text\"\n @change=${handleAddressInput('postalCode')}\n />\n </label>\n </div>\n\n <div class=\"profile-edit-dialog__row profile-edit-dialog__row--equal profile-edit-dialog__row--full\">\n <label aria-label=${`${label} Region`} class=\"label profile-edit-dialog__field\">\n Region\n <input\n class=\"input\"\n type=\"text\"\n name=${regionName}\n .value=${address?.region || ''}\n data-contact-field=\"region\"\n data-entry-node=${address?.entryNode || ''}\n data-row-status=${address?.status || 'n/a'}\n placeholder=\"State / Region\"\n inputmode=\"text\"\n @change=${handleAddressInput('region')}\n />\n </label>\n <label aria-label=${`${label} Country`} class=\"label profile-edit-dialog__field\">\n Country\n <input\n class=\"input\"\n type=\"text\"\n name=${countryName}\n .value=${address?.countryName || ''}\n data-contact-field=\"countryName\"\n data-entry-node=${address?.entryNode || ''}\n data-row-status=${address?.status || 'n/a'}\n placeholder=\"Country\"\n autocomplete=\"country-name\"\n inputmode=\"text\"\n @change=${handleAddressInput('countryName')}\n />\n </label>\n </div>\n `\n}\n\nfunction renderHeadingInfoInput (\n formState: HeadingFormState,\n rerender: () => void\n): TemplateResult {\n const { basicInfo, phone, email, imagePreviewSrc } = formState\n const imageSrcLabel = 'Profile Photo'\n const recommendedImageToLoad = 'Recommended: Square JPG, PNG. Max 2MB.'\n const nameLabel = 'Full Name'\n const nicknameLabel = 'Nickname'\n const pronounsLabel = 'Pronouns'\n const dateOfBirthLabel = 'DOB'\n\n const handleBasicInfoInput = (field: ProfileBasicEditableField) => (e: Event) => {\n const target = e.target as HTMLInputElement\n const nextValue = sanitizeBasicInputFieldValue(target.value)\n if (basicInfo) {\n applyRowFieldChange(basicInfo, field, nextValue, rowHasContent)\n }\n }\n\n const handleDateOfBirthInput = (e: Event) => {\n const target = e.target as HTMLInputElement\n const nextValue = sanitizeBasicInputFieldValue(target.value)\n if (basicInfo) {\n applyRowFieldChange(basicInfo, 'dateOfBirth', toStorageDateISO(nextValue), rowHasContent)\n }\n }\n const handlePronounsInput = (e: Event) => {\n const event = e as ComboboxChangeEvent\n if (!event.detail.option) return\n const nextValue = normalizePronounsValue(String(event.detail.option.value))\n if (basicInfo) {\n applyRowFieldChange(basicInfo, 'pronouns', nextValue, rowHasContent)\n }\n }\n\n const handleUpload = async (e: Event) => {\n const button = e.currentTarget as HTMLButtonElement | null\n const dom = button?.ownerDocument || document\n const fileInput = dom.createElement('input')\n fileInput.type = 'file'\n fileInput.accept = 'image/*'\n fileInput.hidden = true\n\n const cleanupFileInput = () => {\n fileInput.remove()\n }\n\n fileInput.addEventListener('change', async () => {\n const file = fileInput.files?.[0]\n cleanupFileInput()\n if (!file || !basicInfo) return\n\n try {\n formState.pendingImageFile = file\n setHeadingImagePreview(formState, file)\n basicInfo.status = basicInfo.entryNode ? 'modified' : 'new'\n rerender()\n } catch (error) {\n console.error('Profile image upload failed', error)\n }\n }, { once: true })\n\n dom.body.appendChild(fileInput)\n fileInput.click()\n }\n\n const handleCameraInput = async (event: InputEvent) => {\n const file = (event.target as PhotoCapture).value\n\n if (!file || !basicInfo) return\n\n try {\n formState.pendingImageFile = file\n setHeadingImagePreview(formState, file)\n basicInfo.status = basicInfo.entryNode ? 'modified' : 'new'\n rerender()\n } catch (error) {\n console.error('Profile camera upload failed', error)\n }\n }\n\n const handleDelete = async () => {\n if (!basicInfo) return\n formState.pendingImageFile = null\n formState.clearImagePreview()\n applyRowFieldChange(basicInfo, 'imageSrc', '', rowHasContent)\n rerender()\n }\n\n return html`\n <div class=\"profile-edit-dialog__row profile-edit-dialog__row--heading-photo\">\n <header class=\"profile-edit-dialog__image-preview-header\" aria-label=\"Profile Image\">\n <div class=\"profile-edit-dialog__image-frame\">\n ${Image(imagePreviewSrc || basicInfo.imageSrc, basicInfo.name)}\n <solid-ui-photo-capture\n capture-label=\"Take Photo\"\n confirm-label=\"Use Photo\"\n retake-label=\"Retake\"\n cancel-label=\"Close camera\"\n file-name-prefix=\"camera\"\n facing-mode=\"user\"\n @input=${handleCameraInput}\n >\n <button\n slot=\"trigger\"\n type=\"button\"\n class=\"profile-edit-dialog__image-camera-button\"\n aria-label=\"Take a photo\"\n title=\"Take a photo\"\n >\n <icon-lucide-camera aria-hidden=\"true\"></icon-lucide-camera>\n </button>\n </solid-ui-photo-capture>\n </div>\n </header>\n\n <div class=\"profile-edit-dialog__image-preview\" aria-label=\"Profile Photo Preview\">\n <p class=\"profile-edit-dialog__image-preview-label\">${imageSrcLabel}</p>\n <p class=\"profile-edit-dialog__image-preview-description\">${recommendedImageToLoad}</p>\n\n <div class=\"profile-edit-dialog__image-preview-actions\">\n <solid-ui-button\n variant=\"secondary\"\n class=\"profile-edit-dialog__image-button profile-edit-dialog__image-upload-button\"\n aria-label=\"Upload new profile photo\"\n title=\"Upload\"\n @click=${handleUpload}\n >\n Upload\n </solid-ui-button>\n <solid-ui-button\n variant=\"secondary\"\n class=\"profile-edit-dialog__image-button profile-edit-dialog__image-remove-button\"\n aria-label=\"Delete profile photo\"\n title=\"Remove\"\n @click=${handleDelete}\n >\n Remove\n </solid-ui-button>\n </div>\n </div>\n </div>\n <div class=\"profile-edit-dialog__image-camera-capture-row\">\n <div class=\"profile-edit-dialog__image-camera-capture-frame\" hidden></div>\n </div>\n <div class=\"profile-edit\">\n <div class=\"profile-edit-dialog__row profile-edit-dialog__row--equal\">\n <label aria-label=${nameLabel} class=\"label profile-edit-dialog__field\">\n ${nameLabel}\n <input\n class=\"input\"\n type=\"text\"\n name=\"name\"\n .value=${basicInfo?.name || ''}\n required\n data-contact-field=\"name\"\n data-entry-node=${basicInfo?.entryNode || ''}\n data-row-status=${basicInfo?.status || 'n/a'}\n placeholder=\"Full Name\"\n autocomplete=\"name\"\n inputmode=\"text\"\n @change=${handleBasicInfoInput('name')}\n />\n </label>\n <label aria-label=${nicknameLabel} class=\"label profile-edit-dialog__field\">\n ${nicknameLabel}\n <input\n class=\"input\"\n type=\"text\"\n name=\"nickname\"\n .value=${basicInfo?.nickname || ''}\n data-contact-field=\"nickname\"\n data-entry-node=${basicInfo?.entryNode || ''}\n data-row-status=${basicInfo?.status || 'n/a'}\n placeholder=\"Nickname\"\n autocomplete=\"nickname\"\n inputmode=\"text\"\n @change=${handleBasicInfoInput('nickname')}\n />\n </label>\n </div>\n <div class=\"profile-edit-dialog__row profile-edit-dialog__row--equal profile-edit-dialog__row--heading-dob\">\n <div class=\"profile-edit-dialog__field-type profile-edit-dialog__field--stack\">\n <label aria-label=${pronounsLabel} class=\"label\">\n ${pronounsLabel}\n </label>\n <solid-ui-combobox\n select-only\n class=\"profile-edit-dialog__type-select\"\n name=\"pronouns\"\n data-heading-basic-field=\"pronouns\"\n aria-label=${pronounsLabel}\n .value=${normalizePronounsValue(basicInfo?.pronouns || '')}\n @change=${handlePronounsInput}\n >\n ${HEADING_PRONOUN_OPTIONS.map((option) => html`<solid-ui-combobox-option value=${option.value}>${option.label}</solid-ui-combobox-option>`)}\n </solid-ui-combobox>\n </div>\n <div class=\"profile-edit-dialog__field profile-edit-dialog__field--stack\">\n <label aria-label=${dateOfBirthLabel} class=\"label\">\n ${dateOfBirthLabel}\n </label>\n <input\n class=\"input profile-edit-dialog__input--dob\"\n type=\"date\"\n name=\"dateOfBirth\"\n .value=${toStorageDateISO(basicInfo?.dateOfBirth || '')}\n data-contact-field=\"dateOfBirth\"\n data-entry-node=${basicInfo?.entryNode || ''}\n data-row-status=${basicInfo?.status || 'n/a'}\n autocomplete=\"off\"\n data-lpignore=\"true\"\n data-1p-ignore=\"true\"\n data-bwignore=\"true\"\n @change=${handleDateOfBirthInput}\n />\n </div>\n </div>\n <div class=\"profile-edit-dialog__row profile-edit-dialog__row--equal\">\n <div class=\"profile-edit-dialog__field profile-edit-dialog__field--full\">\n ${renderContactPhoneInput({ phone })}\n </div>\n <div class=\"profile-edit-dialog__field profile-edit-dialog__field--full\">\n ${renderContactEmailInputRow({ email })}\n </div>\n </div>\n </div>\n `\n}\n\nfunction renderHeadingEditTemplate (\n form: HTMLFormElement,\n formState: HeadingFormState,\n viewerMode: ViewerMode\n) {\n const rerender = () => renderHeadingEditTemplate(form, formState, viewerMode)\n\n render(html`\n ${renderHeadingInfoInput(formState, rerender)}\n ${renderContactAddressInput({ address: formState.address })}\n ${viewerMode !== 'owner'\n ? html`<p class=\"profile-edit-dialog__login-message\">${ownerLoginRequiredDialogMessageText}</p>`\n : null}\n `, form)\n}\n\nfunction createHeadingEditForm (\n profileData: ProfileDetails,\n viewerMode: ViewerMode\n) {\n const form = document.createElement('form')\n form.classList.add('profile__edit-form', 'profile__edit-form--heading', 'profile-edit-dialog--heading')\n form.autocomplete = 'off'\n form.setAttribute('data-lpignore', 'true')\n form.setAttribute('data-1p-ignore', 'true')\n form.setAttribute('data-bwignore', 'true')\n\n const formState = toFormState(profileData)\n renderHeadingEditTemplate(form, formState, viewerMode)\n\n return { form, formState }\n}\n\nfunction isValidHeadingEmailAddress (value: string): boolean {\n return /^[^\\s@]+@[^\\s@]+\\.[^\\s@]+$/.test(value)\n}\n\nfunction isValidHeadingPhoneNumber (value: string): boolean {\n return /^\\d+$/.test(value)\n}\n\nfunction validateHeadingDataBeforeSave (formState: HeadingFormState): string | null {\n if (!hasNonEmptyText(formState.basicInfo.name)) {\n return 'Full Name is required.'\n }\n\n const { localNumber } = splitPhoneValue(formState.phone?.value || '')\n if (rowHasContent(formState.phone) && !isValidHeadingPhoneNumber(localNumber)) {\n return 'Phone Number 1 should contain only numbers.'\n }\n\n if (rowHasContent(formState.email) && !isValidHeadingEmailAddress(formState.email?.value || '')) {\n return 'Email address must be a valid email address.'\n }\n\n return null\n}\n\nexport async function createHeadingEditDialog (\n _event: Event,\n store: LiveStore,\n subject: NamedNode,\n profileData: ProfileDetails,\n viewerMode: ViewerMode,\n onSaved?: () => Promise<void> | void\n) {\n const dom = document\n const originalPhotoUri = sanitizeTextValue(toText(profileData.imageSrc || ''))\n const { form, formState } = createHeadingEditForm(profileData, viewerMode)\n\n if (formState.basicInfo.imageSrc) {\n const resolvedImageSrc = await resolvePhotoDisplaySrc(store, formState.basicInfo.imageSrc)\n if (resolvedImageSrc && resolvedImageSrc !== formState.basicInfo.imageSrc) {\n setResolvedHeadingPreview(formState, resolvedImageSrc)\n renderHeadingEditTemplate(form, formState, viewerMode)\n }\n }\n\n const result = await openInputDialog({\n title: editHeadingDialogTitleText,\n dom,\n form,\n headerAction: { type: 'none' },\n submitLabel: dialogSubmitLabelText,\n cancelLabel: dialogCancelLabelText,\n shouldCloseWithoutSave: () => {\n const basicInfoOps = summarizeRowOps([formState.basicInfo], rowHasContent)\n const phoneOps = summarizeHeadingContactOps(formState.phone, 'phone', formState.phoneTypeWasMissing)\n const emailOps = summarizeHeadingContactOps(formState.email, 'email', formState.emailTypeWasMissing)\n const addressOps = summarizeRowOps([formState.address], rowHasContent)\n\n return (\n basicInfoOps.create.length === 0 && basicInfoOps.update.length === 0 && basicInfoOps.remove.length === 0 &&\n phoneOps.create.length === 0 && phoneOps.update.length === 0 && phoneOps.remove.length === 0 &&\n emailOps.create.length === 0 && emailOps.update.length === 0 && emailOps.remove.length === 0 &&\n addressOps.create.length === 0 && addressOps.update.length === 0 && addressOps.remove.length === 0\n )\n },\n validate: () => {\n if (viewerMode !== 'owner') {\n return ownerLoginRequiredDialogMessageText\n }\n return validateHeadingDataBeforeSave(formState)\n },\n onSave: async () => {\n if (formState.pendingImageFile) {\n const uploadedUri = await uploadPhotoFile(store, subject, formState.pendingImageFile)\n applyRowFieldChange(formState.basicInfo, 'imageSrc', uploadedUri, rowHasContent)\n }\n\n const phoneOps = summarizeHeadingContactOps(formState.phone, 'phone', formState.phoneTypeWasMissing)\n const emailOps = summarizeHeadingContactOps(formState.email, 'email', formState.emailTypeWasMissing)\n const plan: HeadingMutationPlan = {\n basicOps: summarizeRowOps([formState.basicInfo], rowHasContent),\n phoneOps: mapPhoneOpsForSave(phoneOps),\n emailOps: mapEmailOpsForSave(emailOps),\n addressOps: summarizeRowOps([formState.address], rowHasContent)\n }\n await processHeadingMutations(store, subject, plan)\n\n const nextPhotoUri = sanitizeTextValue(formState.basicInfo.imageSrc || '')\n if (originalPhotoUri && originalPhotoUri !== nextPhotoUri) {\n try {\n invalidateResolvedPhotoDisplaySrc(originalPhotoUri)\n } catch (error) {\n console.warn('Failed to invalidate resolved photo cache', error)\n }\n }\n },\n formatSaveError: (error: unknown) => {\n return error instanceof Error ? error.message : saveHeadingUpdatesFailedMessageText\n }\n })\n\n if (!result) {\n return\n }\n\n if (onSaved) {\n await onSaved()\n }\n}\n"],"mappings":"A,uxBAmEA,IAAM+B,EAAyD,CAC7D,CAAEC,MAAO,SAAUC,MAAO,QAAS,EACnC,CAAED,MAAO,OAAQC,MAAO,MAAO,EAC/B,CAAED,MAAO,OAAQC,MAAO,MAAO,CAAC,EAG5BC,EAAyD,CAC7D,CAAEF,MAAO,WAAYC,MAAO,UAAW,EACvC,CAAED,MAAO,SAAUC,MAAO,QAAS,CAAC,EAGhCE,EAAmD,CACvD,CAAEH,MAAO,SAAUC,MAAO,QAAS,EACnC,CAAED,MAAO,UAAWC,MAAO,SAAU,EACrC,CAAED,MAAO,YAAaC,MAAO,WAAY,CAAC,EAK5C,SAASG,EAAmBC,EAAkC,CAC5D,MAAO,UAAWA,CACpB,CAEA,SAASC,EAAcD,EAAoC,CACzD,MAAO,kBAAmBA,CAC5B,CAEA,SAASE,EAAmBF,EAAkC,CAC5D,MAAO,SAAUA,CACnB,CAEA,SAASG,EAAkCP,EAAeQ,EAA6C,CACrG,OAAOA,EAAQC,KAAMC,GAAWA,EAAOV,QAAUA,CAAK,EAAIA,EAAQQ,EAAQ,EAAE,EAAER,OAAS,EACzF,CAEA,SAASW,EAA8BC,EAA0D,CAC/F,OAAOA,IAAS,QAAUd,EAA6BG,CACzD,CAEA,SAASY,EACPT,EACAQ,EAC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rCC,WAAY9K,EAAAA,gBAAgB,CAACuE,EAAUL,OAAO,EAAG/B,CAAa,CAChE,EACA,MAAM5C,EAAAA,wBAAwB0K,EAAOC,EAASgB,CAAI,EAElD,IAAME,EAAelL,EAAAA,kBAAkBqE,EAAUlB,UAAUV,UAAY,EAAE,EACzE,GAAIyH,GAAoBA,IAAqBgB,EAC3C,GAAI,CACFrK,EAAAA,kCAAkCqJ,CAAgB,CACpD,OAASzB,EAAO,CACdC,QAAQyC,KAAK,4CAA6C1C,CAAK,CACjE,CAEJ,EACA2C,gBAAkB3C,GACTA,aAAiB4C,MAAQ5C,EAAM6C,QAAAA,0CAE1C,CAAC,GAMGrB,GACF,MAAMA,EAAQ,CAElB,C"}
1
+ {"version":3,"file":"HeadingEditDialog.cjs.js","names":["openInputDialog","html","render","Image","processHeadingMutations","combinePhoneValue","splitPhoneValue","normalizeEmailTypeForEdit","normalizePhoneTypeForEdit","toSavedHeadingEmailType","toSavedHeadingPhoneType","applyRowFieldChange","applyRowSelectChange","summarizeRowOps","hasNonEmptyText","sanitizeTextValue","toText","toTypeLabel","ownerLoginRequiredDialogMessageText","sanitizeAddressFieldValue","sanitizeBasicInputFieldValue","sanitizeEmailValue","sanitizePhoneLocalValue","toStorageDateISO","invalidateResolvedPhotoDisplaySrc","resolvePhotoDisplaySrc","uploadPhotoFile","HEADING_PHONE_TYPE_OPTIONS","label","value","HEADING_EMAIL_TYPE_OPTIONS","HEADING_PRONOUN_OPTIONS","isContactPointRow","row","isAddressRow","isProfileBasicRow","normalizeHeadingContactTypeValue","options","some","option","getHeadingContactTypeOptions","kind","withDefaultHeadingContactType","type","rowHasContent","streetAddress","locality","region","postalCode","countryName","name","nickname","imageSrc","location","pronouns","dateOfBirth","normalizePronounsValue","normalized","toLowerCase","replace","toFormState","profileData","basicInfo","entryNode","status","primaryEmail","primaryPhone","primaryAddress","emailTypeWasMissing","phoneTypeWasMissing","normalizedEmailType","normalizedPhoneType","email","valueNode","phone","address","imagePreviewSrc","clearImagePreview","undefined","setHeadingImagePreview","formState","file","URL","createObjectURL","previewUrl","revokeObjectURL","setResolvedHeadingPreview","resolvedImageSrc","mapEmailOpsForSave","ops","mapRow","create","map","update","remove","mapPhoneOpsForSave","summarizeHeadingContactOps","typeWasMissing","length","renderContactPhoneInput","typeLabel","inputName","splitValue","selectedDialCode","dialCode","handleValueInput","e","target","nextValue","handleTypeInput","event","detail","nextType","String","localNumber","renderContactEmailInputRow","renderContactAddressInput","streetAddressName","localityName","regionName","postalCodeName","handleAddressInput","field","renderHeadingInfoInput","rerender","imageSrcLabel","recommendedImageToLoad","nameLabel","nicknameLabel","pronounsLabel","dateOfBirthLabel","handleBasicInfoInput","handleDateOfBirthInput","handlePronounsInput","handleUpload","currentTarget","dom","ownerDocument","document","fileInput","createElement","accept","hidden","cleanupFileInput","addEventListener","files","pendingImageFile","error","console","once","body","appendChild","click","handleCameraInput","handleDelete","renderHeadingEditTemplate","form","viewerMode","createHeadingEditForm","classList","add","autocomplete","setAttribute","isValidHeadingEmailAddress","test","isValidHeadingPhoneNumber","validateHeadingDataBeforeSave","createHeadingEditDialog","_event","store","subject","onSaved","originalPhotoUri","result","title","headerAction","submitLabel","cancelLabel","shouldCloseWithoutSave","basicInfoOps","phoneOps","emailOps","addressOps","validate","onSave","uploadedUri","plan","basicOps","nextPhotoUri","warn","formatSaveError","Error","message","require_dialog","require_imagePreview","require_mutations","require_phoneCountries","require_contactTypeUtils","require_rowState","require_textUtils","require_messageTexts","require_sanitizeUtils","require_dateHelpers","require_imageHelpers","lit_html","HEADING_PHONE_TYPE_OPTIONS","HEADING_EMAIL_TYPE_OPTIONS","HEADING_PRONOUN_OPTIONS","isContactPointRow","row","isAddressRow","isProfileBasicRow","normalizeHeadingContactTypeValue","options","option","value","getHeadingContactTypeOptions","kind","withDefaultHeadingContactType","rowHasContent","normalizePronounsValue","normalized","toFormState","basicInfo","profileData","primaryEmail","primaryPhone","primaryAddress","emailTypeWasMissing","phoneTypeWasMissing","normalizedEmailType","normalizedPhoneType","email","phone","address","setHeadingImagePreview","formState","previewUrl","file","setResolvedHeadingPreview","resolvedImageSrc","mapEmailOpsForSave","mapRow","ops","mapPhoneOpsForSave","summarizeHeadingContactOps","typeWasMissing","renderContactPhoneInput","label","typeLabel","inputName","splitValue","selectedDialCode","target","e","nextValue","event","nextType","renderContactEmailInputRow","renderContactAddressInput","handleAddressInput","field","renderHeadingInfoInput","nameLabel","nicknameLabel","pronounsLabel","handleBasicInfoInput","imagePreviewSrc","rerender","error","dom","fileInput","cleanupFileInput","renderHeadingEditTemplate","form","viewerMode","createHeadingEditForm","isValidHeadingEmailAddress","isValidHeadingPhoneNumber","validateHeadingDataBeforeSave","localNumber","createHeadingEditDialog","originalPhotoUri","store","basicInfoOps","phoneOps","emailOps","addressOps","uploadedUri","subject","plan","nextPhotoUri","onSaved"],"sources":["../../../../../../src/components/profile-heading/editor/sections/heading/HeadingEditDialog.ts"],"sourcesContent":["import { openInputDialog } from '../../ui/dialog'\nimport { html, render, TemplateResult } from 'lit-html'\nimport 'solid-ui/components/button'\nimport 'solid-ui/components/combobox'\nimport 'solid-ui/components/combobox-option'\nimport { type ComboboxChangeEvent } from 'solid-ui/components/combobox'\nimport 'solid-ui/components/photo-capture'\nimport type { PhotoCapture } from 'solid-ui/components/photo-capture'\nimport { ProfileDetails, HeadingMutationPlan, ProfileBasicRow } from './types'\nimport { Image } from './imagePreview'\nimport '../../styles/EditDialogs.css'\nimport { LiveStore, NamedNode } from 'rdflib'\nimport { processHeadingMutations } from './mutations'\nimport { ViewerMode } from '../../../../../types'\nimport {\n combinePhoneValue,\n splitPhoneValue\n} from '../shared/phoneCountries'\nimport {\n normalizeEmailTypeForEdit,\n normalizePhoneTypeForEdit,\n toSavedHeadingEmailType,\n toSavedHeadingPhoneType\n} from '../shared/contactTypeUtils'\nimport { applyRowFieldChange, applyRowSelectChange, summarizeRowOps } from '../shared/rowState'\nimport { hasNonEmptyText, sanitizeTextValue, toText, toTypeLabel } from '../../textUtils'\nimport {\n dialogCancelLabelText,\n dialogSubmitLabelText,\n editHeadingDialogTitleText,\n ownerLoginRequiredDialogMessageText,\n saveHeadingUpdatesFailedMessageText\n} from '../../texts'\nimport '~icons/lucide/camera'\nimport { ContactAddressRow, ContactPointRow } from '../contactInfo/types'\nimport { sanitizeAddressFieldValue, sanitizeBasicInputFieldValue, sanitizeEmailValue, sanitizePhoneLocalValue } from '../shared/sanitizeUtils'\nimport { toStorageDateISO } from './dateHelpers'\nimport { invalidateResolvedPhotoDisplaySrc, resolvePhotoDisplaySrc, uploadPhotoFile } from './imageHelpers'\n/* Note: new design - has address type in More Edit Contacts for now we will leave\n out Address Type, but a ticket will be created to add type later\n so I will keep the code and just comment it out for now.\n new design - has country code, will comment out code for now and create a ticket to add later. */\n\ntype HeadingFormState = {\n basicInfo: ProfileBasicRow\n email: ContactPointRow\n phone: ContactPointRow\n address: ContactAddressRow\n emailTypeWasMissing: boolean\n phoneTypeWasMissing: boolean\n pendingImageFile?: File | null\n imagePreviewSrc: string\n clearImagePreview: () => void\n}\n\ntype HeadingContactTypeOption = {\n label: string\n value: string\n}\n\ntype HeadingPronounsOption = {\n label: string\n value: string\n}\n\ntype HeadingContactTypeKind = 'phone' | 'email'\n\nconst HEADING_PHONE_TYPE_OPTIONS: HeadingContactTypeOption[] = [\n { label: 'Mobile', value: 'Mobile' },\n { label: 'Home', value: 'Home' },\n { label: 'Work', value: 'Work' }\n]\n\nconst HEADING_EMAIL_TYPE_OPTIONS: HeadingContactTypeOption[] = [\n { label: 'Personal', value: 'Personal' },\n { label: 'Office', value: 'Office' }\n]\n\nconst HEADING_PRONOUN_OPTIONS: HeadingPronounsOption[] = [\n { label: 'He/Him', value: 'He/Him' },\n { label: 'She/Her', value: 'She/Her' },\n { label: 'They/Them', value: 'They/Them' }\n]\n\ntype Row = ProfileBasicRow | ContactPointRow | ContactAddressRow\n\nfunction isContactPointRow (row: Row): row is ContactPointRow {\n return 'value' in row\n}\n\nfunction isAddressRow (row: Row): row is ContactAddressRow {\n return 'streetAddress' in row\n}\n\nfunction isProfileBasicRow (row: Row): row is ProfileBasicRow {\n return 'name' in row\n}\n\nfunction normalizeHeadingContactTypeValue (value: string, options: HeadingContactTypeOption[]): string {\n return options.some((option) => option.value === value) ? value : options[0]?.value || ''\n}\n\nfunction getHeadingContactTypeOptions (kind: HeadingContactTypeKind): HeadingContactTypeOption[] {\n return kind === 'phone' ? HEADING_PHONE_TYPE_OPTIONS : HEADING_EMAIL_TYPE_OPTIONS\n}\n\nfunction withDefaultHeadingContactType (\n row: ContactPointRow,\n kind: HeadingContactTypeKind\n): ContactPointRow {\n return {\n ...row,\n type: normalizeHeadingContactTypeValue(row.type || '', getHeadingContactTypeOptions(kind))\n }\n}\n\nfunction rowHasContent (row: Row): boolean {\n if (isContactPointRow(row)) {\n return hasNonEmptyText(row.value)\n }\n if (isAddressRow(row)) {\n return [\n row.streetAddress,\n row.locality,\n row.region,\n row.postalCode,\n row.countryName\n ].some(hasNonEmptyText)\n }\n if (isProfileBasicRow(row)) {\n return [\n row.name,\n row.nickname,\n row.imageSrc,\n row.location,\n row.pronouns,\n row.dateOfBirth\n ].some(hasNonEmptyText)\n }\n return false\n}\n\nfunction normalizePronounsValue (value: string | undefined): string {\n const normalized = sanitizeTextValue(value || '').toLowerCase().replace(/\\s+/g, '')\n if (!normalized) return ''\n if (normalized === 'he' || normalized === 'he/him') return 'He/Him'\n if (normalized === 'she' || normalized === 'she/her') return 'She/Her'\n if (normalized === 'they' || normalized === 'they/them') return 'They/Them'\n return value || ''\n}\n\nfunction toFormState (profileData: ProfileDetails): HeadingFormState {\n const basicInfo: ProfileBasicRow = {\n name: sanitizeTextValue(toText(profileData.name)),\n nickname: sanitizeTextValue(toText(profileData.nickname || '')),\n imageSrc: sanitizeTextValue(toText(profileData.imageSrc || '')),\n location: sanitizeTextValue(toText(profileData.location || '')),\n pronouns: normalizePronounsValue(toText(profileData.pronouns || '')),\n dateOfBirth: sanitizeTextValue(toText(profileData.dateOfBirth || '')),\n entryNode: toText(profileData.entryNode),\n status: toText(profileData.entryNode) ? 'existing' as const : 'new' as const\n }\n const primaryEmail = profileData.primaryEmail\n const primaryPhone = profileData.primaryPhone\n const primaryAddress = profileData.primaryAddress\n const emailTypeWasMissing = !normalizeEmailTypeForEdit(primaryEmail?.type)\n const phoneTypeWasMissing = !normalizePhoneTypeForEdit(primaryPhone?.type)\n\n const normalizedEmailType = normalizeEmailTypeForEdit(primaryEmail?.type)\n const normalizedPhoneType = normalizePhoneTypeForEdit(primaryPhone?.type)\n\n const email: ContactPointRow = {\n value: sanitizeEmailValue(toText(primaryEmail?.valueNode).replace(/^mailto:/i, '')),\n type: normalizedEmailType,\n entryNode: toText(primaryEmail?.entryNode),\n status: toText(primaryEmail?.entryNode) ? 'existing' as const : 'new' as const\n }\n const phone: ContactPointRow = {\n value: sanitizeTextValue(\n toText(primaryPhone?.valueNode || primaryPhone?.entryNode || '').replace(/^tel:/i, '')\n ),\n type: normalizedPhoneType,\n entryNode: toText(primaryPhone?.entryNode || ''),\n status: toText(primaryPhone?.entryNode || '') ? 'existing' as const : 'new' as const\n }\n const address: ContactAddressRow = {\n streetAddress: sanitizeAddressFieldValue(toText(primaryAddress?.streetAddress)),\n locality: sanitizeAddressFieldValue(toText(primaryAddress?.locality)),\n region: sanitizeAddressFieldValue(toText(primaryAddress?.region)),\n postalCode: sanitizeAddressFieldValue(toText(primaryAddress?.postalCode)),\n countryName: sanitizeAddressFieldValue(toText(primaryAddress?.countryName)),\n type: toTypeLabel(primaryAddress?.type),\n entryNode: toText(primaryAddress?.entryNode),\n status: toText(primaryAddress?.entryNode) ? 'existing' as const : 'new' as const\n }\n\n return {\n basicInfo: (basicInfo) || { name: '', nickname: '', imageSrc: '', location: '', pronouns: '', dateOfBirth: '', entryNode: '', status: 'new' },\n email: (email) || { value: '', type: '', entryNode: '', status: 'new' },\n phone: (phone) || { value: '', type: '', entryNode: '', status: 'new' },\n address: (address) || { streetAddress: '', locality: '', region: '', postalCode: '', countryName: '', type: '', entryNode: '', status: 'new' },\n emailTypeWasMissing,\n phoneTypeWasMissing,\n imagePreviewSrc: '',\n clearImagePreview: () => undefined\n }\n}\n\nfunction setHeadingImagePreview (formState: HeadingFormState, file: File) {\n formState.clearImagePreview()\n\n if (typeof URL.createObjectURL !== 'function') {\n formState.imagePreviewSrc = ''\n formState.clearImagePreview = () => undefined\n return\n }\n\n const previewUrl = URL.createObjectURL(file)\n formState.imagePreviewSrc = previewUrl\n formState.clearImagePreview = () => {\n URL.revokeObjectURL(previewUrl)\n formState.imagePreviewSrc = ''\n formState.clearImagePreview = () => undefined\n }\n}\n\nfunction setResolvedHeadingPreview (formState: HeadingFormState, resolvedImageSrc?: string) {\n formState.clearImagePreview()\n\n if (!resolvedImageSrc) {\n return\n }\n\n formState.imagePreviewSrc = resolvedImageSrc\n\n formState.clearImagePreview = () => {\n formState.imagePreviewSrc = ''\n formState.clearImagePreview = () => undefined\n }\n}\n\ntype ProfileBasicEditableField =\n | 'name'\n | 'nickname'\n | 'imageSrc'\n | 'pronouns'\n | 'dateOfBirth'\n\ntype ContactAddressEditableField =\n | 'streetAddress'\n | 'locality'\n | 'region'\n | 'postalCode'\n | 'countryName'\n\ntype ContactPhoneInputRowProps = {\n phone: ContactPointRow\n}\n\ntype ContactEmailInputRowProps = {\n email: ContactPointRow\n}\n\ntype ContactAddressInputRowProps = {\n address: ContactAddressRow\n}\n\nfunction mapEmailOpsForSave (ops: { create: ContactPointRow[], update: ContactPointRow[], remove: ContactPointRow[] }) {\n const mapRow = (row: ContactPointRow): ContactPointRow => ({\n ...withDefaultHeadingContactType(row, 'email'),\n type: toSavedHeadingEmailType(withDefaultHeadingContactType(row, 'email').type)\n })\n\n return {\n create: ops.create.map(mapRow),\n update: ops.update.map(mapRow),\n remove: ops.remove.map(mapRow)\n }\n}\n\nfunction mapPhoneOpsForSave (ops: { create: ContactPointRow[], update: ContactPointRow[], remove: ContactPointRow[] }) {\n const mapRow = (row: ContactPointRow): ContactPointRow => ({\n ...withDefaultHeadingContactType(row, 'phone'),\n type: toSavedHeadingPhoneType(withDefaultHeadingContactType(row, 'phone').type)\n })\n\n return {\n create: ops.create.map(mapRow),\n update: ops.update.map(mapRow),\n remove: ops.remove.map(mapRow)\n }\n}\n\nfunction summarizeHeadingContactOps (\n row: ContactPointRow,\n kind: HeadingContactTypeKind,\n typeWasMissing: boolean\n) {\n const ops = summarizeRowOps([row], rowHasContent)\n\n if (\n typeWasMissing &&\n row.entryNode &&\n row.status === 'existing' &&\n rowHasContent(row) &&\n ops.create.length === 0 &&\n ops.update.length === 0 &&\n ops.remove.length === 0\n ) {\n return {\n create: ops.create,\n update: [withDefaultHeadingContactType({ ...row, status: 'modified' }, kind)],\n remove: ops.remove\n }\n }\n\n return ops\n}\n\nfunction renderContactPhoneInput ({\n phone\n}: ContactPhoneInputRowProps) {\n const label = 'Mobile Number'\n const typeLabel = 'Phone Type 1'\n const inputName = 'phone-value'\n const splitValue = splitPhoneValue(phone?.value || '')\n const selectedDialCode = splitValue.dialCode\n\n const handleValueInput = (e: Event) => {\n const target = e.target as HTMLInputElement\n const nextValue = sanitizePhoneLocalValue(target.value)\n if (phone) {\n applyRowFieldChange(phone, 'value', combinePhoneValue(selectedDialCode, nextValue), rowHasContent)\n }\n }\n\n const handleTypeInput = (e: Event) => {\n const event = e as ComboboxChangeEvent\n if (!event.detail.option) return\n const nextType = String(event.detail.option.value)\n if (phone) {\n applyRowSelectChange(phone, 'type', nextType)\n }\n }\n\n return html`\n <div class=\"profile-edit-dialog__row profile-edit-dialog__row--equal profile-edit-dialog__row--contact-point\">\n <div class=\"profile-edit-dialog__field\">\n <label aria-label=${label} class=\"label\">\n ${label}\n <input\n class=\"input\"\n type=\"tel\"\n name=${inputName}\n .value=${splitValue.localNumber}\n required\n data-contact-field=\"value\"\n data-entry-node=${phone?.entryNode || ''}\n data-row-status=${phone?.status || 'n/a'}\n placeholder=${label}\n autocomplete=\"tel-national\"\n inputmode=\"tel\"\n @input=${handleValueInput}\n />\n </label>\n </div>\n <label aria-label=${typeLabel} class=\"label profile-edit-dialog__field-type profile-edit-dialog__field-type--contact-point\">\n <solid-ui-combobox\n select-only\n class=\"profile-edit-dialog__type-select\"\n id=${`phone-type-select-${inputName}`}\n aria-label=${typeLabel}\n .value=${normalizeHeadingContactTypeValue(phone?.type || '', HEADING_PHONE_TYPE_OPTIONS)}\n @change=${handleTypeInput}\n >\n ${HEADING_PHONE_TYPE_OPTIONS.map((option) => html`<solid-ui-combobox-option value=${option.value}>${option.label}</solid-ui-combobox-option>`)}\n </solid-ui-combobox>\n </label>\n </div>\n `\n}\n\nfunction renderContactEmailInputRow ({\n email\n}: ContactEmailInputRowProps) {\n const label = 'Email'\n const typeLabel = 'Email Type'\n const inputName = 'email-value'\n\n const handleValueInput = (e: Event) => {\n const target = e.target as HTMLInputElement\n const nextValue = sanitizeEmailValue(target.value)\n if (email) {\n applyRowFieldChange(email, 'value', nextValue, rowHasContent)\n }\n }\n\n const handleTypeInput = (e: Event) => {\n const event = e as ComboboxChangeEvent\n if (!event.detail.option) return\n const nextType = String(event.detail.option.value)\n if (email) {\n applyRowSelectChange(email, 'type', nextType)\n }\n }\n\n return html`\n <div class=\"profile-edit-dialog__row profile-edit-dialog__row--equal profile-edit-dialog__row--contact-point\">\n <label aria-label=${label} class=\"label profile-edit-dialog__field\">\n ${label}\n <input\n class=\"input\"\n type=\"email\"\n name=${inputName}\n .value=${email?.value || ''}\n required\n data-contact-field=\"value\"\n data-entry-node=${email?.entryNode || ''}\n data-row-status=${email?.status || 'n/a'}\n placeholder=\"Email Address\"\n autocomplete=\"email\"\n inputmode=\"email\"\n @input=${handleValueInput}\n />\n </label>\n <label aria-label=${typeLabel} class=\"label profile-edit-dialog__field-type profile-edit-dialog__field-type--contact-point\">\n <solid-ui-combobox\n select-only\n class=\"profile-edit-dialog__type-select\"\n id=${`email-type-select-${inputName}`}\n aria-label=${typeLabel}\n .value=${normalizeHeadingContactTypeValue(email?.type || '', HEADING_EMAIL_TYPE_OPTIONS)}\n @change=${handleTypeInput}\n >\n ${HEADING_EMAIL_TYPE_OPTIONS.map((option) => html`<solid-ui-combobox-option value=${option.value}>${option.label}</solid-ui-combobox-option>`)}\n </solid-ui-combobox>\n </label>\n </div>\n `\n}\n\nfunction renderContactAddressInput ({\n address\n}: ContactAddressInputRowProps) {\n const label = 'Address'\n /* const typeLabel = 'Address Type' */\n /* const typeInputName = 'address-type' */\n /* const addressTypeSelectId = 'address-type-select' */\n const streetAddressName = 'address-street'\n const localityName = 'address-locality'\n const regionName = 'address-region'\n const postalCodeName = 'address-postal'\n const countryName = 'address-country'\n\n const handleAddressInput = (field: ContactAddressEditableField) => (e: Event) => {\n const target = e.target as HTMLInputElement\n const nextValue = sanitizeAddressFieldValue(target.value)\n if (address) {\n applyRowFieldChange(address, field, nextValue, rowHasContent)\n }\n }\n\n /* const handleTypeInput = (e: Event) => {\n const target = e.target as HTMLInputElement\n const nextType = target.value\n if (address) {\n applyRowSelectChange(address, 'type', nextType)\n }\n } */\n\n return html`\n <label aria-label=${`${label} Street`} class=\"label profile-edit-dialog__field profile-edit-dialog__field--row-width\">\n Street Address\n <input\n class=\"input\"\n type=\"text\"\n name=${streetAddressName}\n .value=${address?.streetAddress || ''}\n required\n data-contact-field=\"streetAddress\"\n data-entry-node=${address?.entryNode || ''}\n data-row-status=${address?.status || 'n/a'}\n placeholder=\"Street Address\"\n autocomplete=\"street-address\"\n inputmode=\"text\"\n @change=${handleAddressInput('streetAddress')}\n />\n </label>\n\n <div class=\"profile-edit-dialog__row profile-edit-dialog__row--equal profile-edit-dialog__row--full\">\n <label aria-label=${`${label} Locality`} class=\"label profile-edit-dialog__field\">\n Locality\n <input\n class=\"input\"\n type=\"text\"\n name=${localityName}\n .value=${address?.locality || ''}\n data-contact-field=\"locality\"\n data-entry-node=${address?.entryNode || ''}\n data-row-status=${address?.status || 'n/a'}\n placeholder=\"City / Locality\"\n autocomplete=\"address-level2\"\n inputmode=\"text\"\n @change=${handleAddressInput('locality')}\n />\n </label>\n <label aria-label=${`${label} Postal Code`} class=\"label profile-edit-dialog__field\">\n Postal Code\n <input\n class=\"input\"\n type=\"text\"\n name=${postalCodeName}\n .value=${address?.postalCode || ''}\n data-contact-field=\"postalCode\"\n data-entry-node=${address?.entryNode || ''}\n data-row-status=${address?.status || 'n/a'}\n placeholder=\"Postal Code\"\n autocomplete=\"postal-code\"\n inputmode=\"text\"\n @change=${handleAddressInput('postalCode')}\n />\n </label>\n </div>\n\n <div class=\"profile-edit-dialog__row profile-edit-dialog__row--equal profile-edit-dialog__row--full\">\n <label aria-label=${`${label} Region`} class=\"label profile-edit-dialog__field\">\n Region\n <input\n class=\"input\"\n type=\"text\"\n name=${regionName}\n .value=${address?.region || ''}\n data-contact-field=\"region\"\n data-entry-node=${address?.entryNode || ''}\n data-row-status=${address?.status || 'n/a'}\n placeholder=\"State / Region\"\n inputmode=\"text\"\n @change=${handleAddressInput('region')}\n />\n </label>\n <label aria-label=${`${label} Country`} class=\"label profile-edit-dialog__field\">\n Country\n <input\n class=\"input\"\n type=\"text\"\n name=${countryName}\n .value=${address?.countryName || ''}\n data-contact-field=\"countryName\"\n data-entry-node=${address?.entryNode || ''}\n data-row-status=${address?.status || 'n/a'}\n placeholder=\"Country\"\n autocomplete=\"country-name\"\n inputmode=\"text\"\n @change=${handleAddressInput('countryName')}\n />\n </label>\n </div>\n `\n}\n\nfunction renderHeadingInfoInput (\n formState: HeadingFormState,\n rerender: () => void\n): TemplateResult {\n const { basicInfo, phone, email, imagePreviewSrc } = formState\n const imageSrcLabel = 'Profile Photo'\n const recommendedImageToLoad = 'Recommended: Square JPG, PNG. Max 2MB.'\n const nameLabel = 'Full Name'\n const nicknameLabel = 'Nickname'\n const pronounsLabel = 'Pronouns'\n const dateOfBirthLabel = 'DOB'\n\n const handleBasicInfoInput = (field: ProfileBasicEditableField) => (e: Event) => {\n const target = e.target as HTMLInputElement\n const nextValue = sanitizeBasicInputFieldValue(target.value)\n if (basicInfo) {\n applyRowFieldChange(basicInfo, field, nextValue, rowHasContent)\n }\n }\n\n const handleDateOfBirthInput = (e: Event) => {\n const target = e.target as HTMLInputElement\n const nextValue = sanitizeBasicInputFieldValue(target.value)\n if (basicInfo) {\n applyRowFieldChange(basicInfo, 'dateOfBirth', toStorageDateISO(nextValue), rowHasContent)\n }\n }\n const handlePronounsInput = (e: Event) => {\n const event = e as ComboboxChangeEvent\n if (!event.detail.option) return\n const nextValue = normalizePronounsValue(String(event.detail.option.value))\n if (basicInfo) {\n applyRowFieldChange(basicInfo, 'pronouns', nextValue, rowHasContent)\n }\n }\n\n const handleUpload = async (e: Event) => {\n const button = e.currentTarget as HTMLButtonElement | null\n const dom = button?.ownerDocument || document\n const fileInput = dom.createElement('input')\n fileInput.type = 'file'\n fileInput.accept = 'image/*'\n fileInput.hidden = true\n\n const cleanupFileInput = () => {\n fileInput.remove()\n }\n\n fileInput.addEventListener('change', async () => {\n const file = fileInput.files?.[0]\n cleanupFileInput()\n if (!file || !basicInfo) return\n\n try {\n formState.pendingImageFile = file\n setHeadingImagePreview(formState, file)\n basicInfo.status = basicInfo.entryNode ? 'modified' : 'new'\n rerender()\n } catch (error) {\n console.error('Profile image upload failed', error)\n }\n }, { once: true })\n\n dom.body.appendChild(fileInput)\n fileInput.click()\n }\n\n const handleCameraInput = async (event: InputEvent) => {\n const file = (event.target as PhotoCapture).value\n\n if (!file || !basicInfo) return\n\n try {\n formState.pendingImageFile = file\n setHeadingImagePreview(formState, file)\n basicInfo.status = basicInfo.entryNode ? 'modified' : 'new'\n rerender()\n } catch (error) {\n console.error('Profile camera upload failed', error)\n }\n }\n\n const handleDelete = async () => {\n if (!basicInfo) return\n formState.pendingImageFile = null\n formState.clearImagePreview()\n applyRowFieldChange(basicInfo, 'imageSrc', '', rowHasContent)\n rerender()\n }\n\n return html`\n <div class=\"profile-edit-dialog__row profile-edit-dialog__row--heading-photo\">\n <header class=\"profile-edit-dialog__image-preview-header\" aria-label=\"Profile Image\">\n <div class=\"profile-edit-dialog__image-frame\">\n ${Image(imagePreviewSrc || basicInfo.imageSrc, basicInfo.name)}\n <solid-ui-photo-capture\n capture-label=\"Take Photo\"\n confirm-label=\"Use Photo\"\n retake-label=\"Retake\"\n cancel-label=\"Close camera\"\n file-name-prefix=\"camera\"\n facing-mode=\"user\"\n @input=${handleCameraInput}\n >\n <button\n slot=\"trigger\"\n type=\"button\"\n class=\"profile-edit-dialog__image-camera-button\"\n aria-label=\"Take a photo\"\n title=\"Take a photo\"\n >\n <icon-lucide-camera aria-hidden=\"true\"></icon-lucide-camera>\n </button>\n </solid-ui-photo-capture>\n </div>\n </header>\n\n <div class=\"profile-edit-dialog__image-preview\" aria-label=\"Profile Photo Preview\">\n <p class=\"profile-edit-dialog__image-preview-label\">${imageSrcLabel}</p>\n <p class=\"profile-edit-dialog__image-preview-description\">${recommendedImageToLoad}</p>\n\n <div class=\"profile-edit-dialog__image-preview-actions\">\n <solid-ui-button\n variant=\"secondary\"\n class=\"profile-edit-dialog__image-button profile-edit-dialog__image-upload-button\"\n aria-label=\"Upload new profile photo\"\n title=\"Upload\"\n @click=${handleUpload}\n >\n Upload\n </solid-ui-button>\n <solid-ui-button\n variant=\"secondary\"\n class=\"profile-edit-dialog__image-button profile-edit-dialog__image-remove-button\"\n aria-label=\"Delete profile photo\"\n title=\"Remove\"\n @click=${handleDelete}\n >\n Remove\n </solid-ui-button>\n </div>\n </div>\n </div>\n <div class=\"profile-edit-dialog__image-camera-capture-row\">\n <div class=\"profile-edit-dialog__image-camera-capture-frame\" hidden></div>\n </div>\n <div class=\"profile-edit\">\n <div class=\"profile-edit-dialog__row profile-edit-dialog__row--equal\">\n <label aria-label=${nameLabel} class=\"label profile-edit-dialog__field\">\n ${nameLabel}\n <input\n class=\"input\"\n type=\"text\"\n name=\"name\"\n .value=${basicInfo?.name || ''}\n required\n data-contact-field=\"name\"\n data-entry-node=${basicInfo?.entryNode || ''}\n data-row-status=${basicInfo?.status || 'n/a'}\n placeholder=\"Full Name\"\n autocomplete=\"name\"\n inputmode=\"text\"\n @change=${handleBasicInfoInput('name')}\n />\n </label>\n <label aria-label=${nicknameLabel} class=\"label profile-edit-dialog__field\">\n ${nicknameLabel}\n <input\n class=\"input\"\n type=\"text\"\n name=\"nickname\"\n .value=${basicInfo?.nickname || ''}\n data-contact-field=\"nickname\"\n data-entry-node=${basicInfo?.entryNode || ''}\n data-row-status=${basicInfo?.status || 'n/a'}\n placeholder=\"Nickname\"\n autocomplete=\"nickname\"\n inputmode=\"text\"\n @change=${handleBasicInfoInput('nickname')}\n />\n </label>\n </div>\n <div class=\"profile-edit-dialog__row profile-edit-dialog__row--equal profile-edit-dialog__row--heading-dob\">\n <div class=\"profile-edit-dialog__field-type profile-edit-dialog__field--stack\">\n <label aria-label=${pronounsLabel} class=\"label\">\n ${pronounsLabel}\n </label>\n <solid-ui-combobox\n select-only\n class=\"profile-edit-dialog__type-select\"\n name=\"pronouns\"\n data-heading-basic-field=\"pronouns\"\n aria-label=${pronounsLabel}\n .value=${normalizePronounsValue(basicInfo?.pronouns || '')}\n @change=${handlePronounsInput}\n >\n ${HEADING_PRONOUN_OPTIONS.map((option) => html`<solid-ui-combobox-option value=${option.value}>${option.label}</solid-ui-combobox-option>`)}\n </solid-ui-combobox>\n </div>\n <div class=\"profile-edit-dialog__field profile-edit-dialog__field--stack\">\n <label aria-label=${dateOfBirthLabel} class=\"label\">\n ${dateOfBirthLabel}\n </label>\n <input\n class=\"input profile-edit-dialog__input--dob\"\n type=\"date\"\n name=\"dateOfBirth\"\n .value=${toStorageDateISO(basicInfo?.dateOfBirth || '')}\n data-contact-field=\"dateOfBirth\"\n data-entry-node=${basicInfo?.entryNode || ''}\n data-row-status=${basicInfo?.status || 'n/a'}\n autocomplete=\"off\"\n data-lpignore=\"true\"\n data-1p-ignore=\"true\"\n data-bwignore=\"true\"\n @change=${handleDateOfBirthInput}\n />\n </div>\n </div>\n <div class=\"profile-edit-dialog__row profile-edit-dialog__row--equal\">\n <div class=\"profile-edit-dialog__field profile-edit-dialog__field--full\">\n ${renderContactPhoneInput({ phone })}\n </div>\n <div class=\"profile-edit-dialog__field profile-edit-dialog__field--full\">\n ${renderContactEmailInputRow({ email })}\n </div>\n </div>\n </div>\n `\n}\n\nfunction renderHeadingEditTemplate (\n form: HTMLFormElement,\n formState: HeadingFormState,\n viewerMode: ViewerMode\n) {\n const rerender = () => renderHeadingEditTemplate(form, formState, viewerMode)\n\n render(html`\n ${renderHeadingInfoInput(formState, rerender)}\n ${renderContactAddressInput({ address: formState.address })}\n ${viewerMode !== 'owner'\n ? html`<p class=\"profile-edit-dialog__login-message\">${ownerLoginRequiredDialogMessageText}</p>`\n : null}\n `, form)\n}\n\nfunction createHeadingEditForm (\n profileData: ProfileDetails,\n viewerMode: ViewerMode\n) {\n const form = document.createElement('form')\n form.classList.add('profile__edit-form', 'profile__edit-form--heading', 'profile-edit-dialog--heading')\n form.autocomplete = 'off'\n form.setAttribute('data-lpignore', 'true')\n form.setAttribute('data-1p-ignore', 'true')\n form.setAttribute('data-bwignore', 'true')\n\n const formState = toFormState(profileData)\n renderHeadingEditTemplate(form, formState, viewerMode)\n\n return { form, formState }\n}\n\nfunction isValidHeadingEmailAddress (value: string): boolean {\n return /^[^\\s@]+@[^\\s@]+\\.[^\\s@]+$/.test(value)\n}\n\nfunction isValidHeadingPhoneNumber (value: string): boolean {\n return /^\\d+$/.test(value)\n}\n\nfunction validateHeadingDataBeforeSave (formState: HeadingFormState): string | null {\n if (!hasNonEmptyText(formState.basicInfo.name)) {\n return 'Full Name is required.'\n }\n\n const { localNumber } = splitPhoneValue(formState.phone?.value || '')\n if (rowHasContent(formState.phone) && !isValidHeadingPhoneNumber(localNumber)) {\n return 'Phone Number 1 should contain only numbers.'\n }\n\n if (rowHasContent(formState.email) && !isValidHeadingEmailAddress(formState.email?.value || '')) {\n return 'Email address must be a valid email address.'\n }\n\n return null\n}\n\nexport async function createHeadingEditDialog (\n _event: Event,\n store: LiveStore,\n subject: NamedNode,\n profileData: ProfileDetails,\n viewerMode: ViewerMode,\n onSaved?: () => Promise<void> | void\n) {\n const dom = document\n const originalPhotoUri = sanitizeTextValue(toText(profileData.imageSrc || ''))\n const { form, formState } = createHeadingEditForm(profileData, viewerMode)\n\n if (formState.basicInfo.imageSrc) {\n const resolvedImageSrc = await resolvePhotoDisplaySrc(store, formState.basicInfo.imageSrc)\n if (resolvedImageSrc && resolvedImageSrc !== formState.basicInfo.imageSrc) {\n setResolvedHeadingPreview(formState, resolvedImageSrc)\n renderHeadingEditTemplate(form, formState, viewerMode)\n }\n }\n\n const result = await openInputDialog({\n title: editHeadingDialogTitleText,\n dom,\n form,\n headerAction: { type: 'none' },\n submitLabel: dialogSubmitLabelText,\n cancelLabel: dialogCancelLabelText,\n shouldCloseWithoutSave: () => {\n const basicInfoOps = summarizeRowOps([formState.basicInfo], rowHasContent)\n const phoneOps = summarizeHeadingContactOps(formState.phone, 'phone', formState.phoneTypeWasMissing)\n const emailOps = summarizeHeadingContactOps(formState.email, 'email', formState.emailTypeWasMissing)\n const addressOps = summarizeRowOps([formState.address], rowHasContent)\n\n return (\n basicInfoOps.create.length === 0 && basicInfoOps.update.length === 0 && basicInfoOps.remove.length === 0 &&\n phoneOps.create.length === 0 && phoneOps.update.length === 0 && phoneOps.remove.length === 0 &&\n emailOps.create.length === 0 && emailOps.update.length === 0 && emailOps.remove.length === 0 &&\n addressOps.create.length === 0 && addressOps.update.length === 0 && addressOps.remove.length === 0\n )\n },\n validate: () => {\n if (viewerMode !== 'owner') {\n return ownerLoginRequiredDialogMessageText\n }\n return validateHeadingDataBeforeSave(formState)\n },\n onSave: async () => {\n if (formState.pendingImageFile) {\n const uploadedUri = await uploadPhotoFile(store, subject, formState.pendingImageFile)\n applyRowFieldChange(formState.basicInfo, 'imageSrc', uploadedUri, rowHasContent)\n }\n\n const phoneOps = summarizeHeadingContactOps(formState.phone, 'phone', formState.phoneTypeWasMissing)\n const emailOps = summarizeHeadingContactOps(formState.email, 'email', formState.emailTypeWasMissing)\n const plan: HeadingMutationPlan = {\n basicOps: summarizeRowOps([formState.basicInfo], rowHasContent),\n phoneOps: mapPhoneOpsForSave(phoneOps),\n emailOps: mapEmailOpsForSave(emailOps),\n addressOps: summarizeRowOps([formState.address], rowHasContent)\n }\n await processHeadingMutations(store, subject, plan)\n\n const nextPhotoUri = sanitizeTextValue(formState.basicInfo.imageSrc || '')\n if (originalPhotoUri && originalPhotoUri !== nextPhotoUri) {\n try {\n invalidateResolvedPhotoDisplaySrc(originalPhotoUri)\n } catch (error) {\n console.warn('Failed to invalidate resolved photo cache', error)\n }\n }\n },\n formatSaveError: (error: unknown) => {\n return error instanceof Error ? error.message : saveHeadingUpdatesFailedMessageText\n }\n })\n\n if (!result) {\n return\n }\n\n if (onSaved) {\n await onSaved()\n }\n}\n"],"mappings":"A,6xBAmEA,IAAM2B,EAAyD,CAC7D,CAAEC,MAAO,SAAUC,MAAO,QAAS,EACnC,CAAED,MAAO,OAAQC,MAAO,MAAO,EAC/B,CAAED,MAAO,OAAQC,MAAO,MAAO,CAAC,EAG5BC,EAAyD,CAC7D,CAAEF,MAAO,WAAYC,MAAO,UAAW,EACvC,CAAED,MAAO,SAAUC,MAAO,QAAS,CAAC,EAGhCE,EAAmD,CACvD,CAAEH,MAAO,SAAUC,MAAO,QAAS,EACnC,CAAED,MAAO,UAAWC,MAAO,SAAU,EACrC,CAAED,MAAO,YAAaC,MAAO,WAAY,CAAC,EAK5C,SAASG,EAAmBC,EAAkC,CAC5D,MAAO,UAAWA,CACpB,CAEA,SAASC,EAAcD,EAAoC,CACzD,MAAO,kBAAmBA,CAC5B,CAEA,SAASE,EAAmBF,EAAkC,CAC5D,MAAO,SAAUA,CACnB,CAEA,SAASG,EAAkCP,EAAeQ,EAA6C,CACrG,OAAOA,EAAQC,KAAMC,GAAWA,EAAOV,QAAUA,CAAK,EAAIA,EAAQQ,EAAQ,EAAE,EAAER,OAAS,EACzF,CAEA,SAASW,EAA8BC,EAA0D,C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