solid-panes 5.1.0-3 → 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 (174) hide show
  1. package/dist/RDFXMLPane.d.ts.map +1 -1
  2. package/dist/RDFXMLPane2.cjs.js +1 -1
  3. package/dist/RDFXMLPane2.cjs.js.map +1 -1
  4. package/dist/RDFXMLPane2.esm.js +3 -3
  5. package/dist/RDFXMLPane2.esm.js.map +1 -1
  6. package/dist/components/editor-card/EditorCard.cjs.js +2 -2
  7. package/dist/components/editor-card/EditorCard.cjs.js.map +1 -1
  8. package/dist/components/editor-card/EditorCard.d.ts +2 -0
  9. package/dist/components/editor-card/EditorCard.d.ts.map +1 -1
  10. package/dist/components/editor-card/EditorCard.esm.js +68 -43
  11. package/dist/components/editor-card/EditorCard.esm.js.map +1 -1
  12. package/dist/components/editor-card/EditorCard.styles.cjs.js.map +1 -1
  13. package/dist/components/editor-card/EditorCard.styles.esm.js.map +1 -1
  14. package/dist/components/header/Header.cjs.js.map +1 -1
  15. package/dist/components/header/Header.esm.js.map +1 -1
  16. package/dist/components/header/Header.styles.cjs.js.map +1 -1
  17. package/dist/components/header/Header.styles.esm.js.map +1 -1
  18. package/dist/components/navbar/Navbar.cjs.js.map +1 -1
  19. package/dist/components/navbar/Navbar.esm.js.map +1 -1
  20. package/dist/components/navbar/Navbar.styles.cjs.js.map +1 -1
  21. package/dist/components/navbar/Navbar.styles.esm.js.map +1 -1
  22. package/dist/components/profile-heading/ProfileHeading.cjs.js +4 -4
  23. package/dist/components/profile-heading/ProfileHeading.cjs.js.map +1 -1
  24. package/dist/components/profile-heading/ProfileHeading.d.ts +4 -0
  25. package/dist/components/profile-heading/ProfileHeading.d.ts.map +1 -1
  26. package/dist/components/profile-heading/ProfileHeading.esm.js +123 -107
  27. package/dist/components/profile-heading/ProfileHeading.esm.js.map +1 -1
  28. package/dist/components/profile-heading/ProfileHeading.styles.cjs.js.map +1 -1
  29. package/dist/components/profile-heading/ProfileHeading.styles.esm.js.map +1 -1
  30. package/dist/components/profile-heading/editor/sections/heading/HeadingEditDialog.cjs.js +19 -19
  31. package/dist/components/profile-heading/editor/sections/heading/HeadingEditDialog.cjs.js.map +1 -1
  32. package/dist/components/profile-heading/editor/sections/heading/HeadingEditDialog.esm.js +86 -86
  33. package/dist/components/profile-heading/editor/sections/heading/HeadingEditDialog.esm.js.map +1 -1
  34. package/dist/components/profile-heading/editor/sections/heading/dateHelpers.cjs.js.map +1 -1
  35. package/dist/components/profile-heading/editor/sections/heading/dateHelpers.esm.js.map +1 -1
  36. package/dist/components/profile-heading/editor/sections/heading/imageHelpers.cjs.js.map +1 -1
  37. package/dist/components/profile-heading/editor/sections/heading/imagePreview.cjs.js.map +1 -1
  38. package/dist/components/profile-heading/editor/sections/heading/mutations.cjs.js +1 -1
  39. package/dist/components/profile-heading/editor/sections/heading/mutations.cjs.js.map +1 -1
  40. package/dist/components/profile-heading/editor/sections/heading/mutations.esm.js +61 -61
  41. package/dist/components/profile-heading/editor/sections/shared/contactTypeUtils.cjs.js.map +1 -1
  42. package/dist/components/profile-heading/editor/sections/shared/contactTypeUtils.esm.js.map +1 -1
  43. package/dist/components/profile-heading/editor/sections/shared/idNodeFactory.cjs.js.map +1 -1
  44. package/dist/components/profile-heading/editor/sections/shared/phoneCountries.cjs.js.map +1 -1
  45. package/dist/components/profile-heading/editor/sections/shared/phoneCountries.esm.js.map +1 -1
  46. package/dist/components/profile-heading/editor/sections/shared/rdfMutationHelpers.cjs.js.map +1 -1
  47. package/dist/components/profile-heading/editor/sections/shared/rdfMutationHelpers.esm.js.map +1 -1
  48. package/dist/components/profile-heading/editor/sections/shared/rowState.cjs.js.map +1 -1
  49. package/dist/components/profile-heading/editor/sections/shared/rowState.esm.js.map +1 -1
  50. package/dist/components/profile-heading/editor/sections/shared/sanitizeUtils.cjs.js.map +1 -1
  51. package/dist/components/profile-heading/editor/textUtils.cjs.js.map +1 -1
  52. package/dist/components/profile-heading/editor/textUtils.esm.js.map +1 -1
  53. package/dist/components/profile-heading/editor/texts/dialogTexts.cjs.js.map +1 -1
  54. package/dist/components/profile-heading/editor/texts/dialogTexts.esm.js.map +1 -1
  55. package/dist/components/profile-heading/editor/texts/messageTexts.cjs.js.map +1 -1
  56. package/dist/components/profile-heading/editor/texts/messageTexts.esm.js.map +1 -1
  57. package/dist/components/profile-heading/editor/ui/dialog2.cjs.js +1 -1
  58. package/dist/components/profile-heading/editor/ui/dialog2.cjs.js.map +1 -1
  59. package/dist/components/profile-heading/editor/ui/dialog2.esm.js +1 -1
  60. package/dist/components/profile-heading/editor/ui/dialog2.esm.js.map +1 -1
  61. package/dist/components/profile-heading/friendActions.cjs.js +1 -1
  62. package/dist/components/profile-heading/friendActions.cjs.js.map +1 -1
  63. package/dist/components/profile-heading/friendActions.esm.js +5 -5
  64. package/dist/components/profile-heading/profileHeadingData.cjs.js.map +1 -1
  65. package/dist/components/resource-action-dialog/ResourceActionDialog.cjs.js +33 -0
  66. package/dist/components/resource-action-dialog/ResourceActionDialog.cjs.js.map +1 -0
  67. package/dist/components/resource-action-dialog/ResourceActionDialog.d.ts +16 -0
  68. package/dist/components/resource-action-dialog/ResourceActionDialog.d.ts.map +1 -0
  69. package/dist/components/resource-action-dialog/ResourceActionDialog.esm.js +309 -0
  70. package/dist/components/resource-action-dialog/ResourceActionDialog.esm.js.map +1 -0
  71. package/dist/components/resource-action-dialog/ResourceActionDialog.styles.cjs.js +2 -0
  72. package/dist/components/resource-action-dialog/ResourceActionDialog.styles.cjs.js.map +1 -0
  73. package/dist/components/resource-action-dialog/ResourceActionDialog.styles.esm.js +6 -0
  74. package/dist/components/resource-action-dialog/ResourceActionDialog.styles.esm.js.map +1 -0
  75. package/dist/dataContentPane.d.ts.map +1 -1
  76. package/dist/dataContentPane2.cjs.js +1 -1
  77. package/dist/dataContentPane2.cjs.js.map +1 -1
  78. package/dist/dataContentPane2.esm.js +90 -78
  79. package/dist/dataContentPane2.esm.js.map +1 -1
  80. package/dist/humanReadablePane.d.ts +1 -0
  81. package/dist/humanReadablePane.d.ts.map +1 -1
  82. package/dist/humanReadablePane2.cjs.js +147 -15
  83. package/dist/humanReadablePane2.cjs.js.map +1 -1
  84. package/dist/humanReadablePane2.esm.js +281 -114
  85. package/dist/humanReadablePane2.esm.js.map +1 -1
  86. package/dist/imagePane.d.ts.map +1 -1
  87. package/dist/imagePane2.cjs.js +1 -1
  88. package/dist/imagePane2.cjs.js.map +1 -1
  89. package/dist/imagePane2.esm.js +9 -7
  90. package/dist/imagePane2.esm.js.map +1 -1
  91. package/dist/index.cjs.js +1 -1
  92. package/dist/index.cjs.js.map +1 -1
  93. package/dist/index.esm.js +3 -3
  94. package/dist/internal/internalPane.d.ts.map +1 -1
  95. package/dist/internal/internalPane2.cjs.js +1 -1
  96. package/dist/internal/internalPane2.cjs.js.map +1 -1
  97. package/dist/internal/internalPane2.esm.js +55 -60
  98. package/dist/internal/internalPane2.esm.js.map +1 -1
  99. package/dist/mainPage/header.cjs.js +1 -1
  100. package/dist/mainPage/header.esm.js +2 -2
  101. package/dist/mainPage/index.cjs.js +1 -1
  102. package/dist/mainPage/index.cjs.js.map +1 -1
  103. package/dist/mainPage/index.d.ts.map +1 -1
  104. package/dist/mainPage/index.esm.js +35 -26
  105. package/dist/mainPage/index.esm.js.map +1 -1
  106. package/dist/mainPage/navbar.cjs.js +1 -1
  107. package/dist/mainPage/navbar.cjs.js.map +1 -1
  108. package/dist/mainPage/navbar.esm.js +15 -15
  109. package/dist/mainPage/navigation.cjs.js +1 -1
  110. package/dist/mainPage/navigation.cjs.js.map +1 -1
  111. package/dist/mainPage/navigation.esm.js +4 -4
  112. package/dist/mainPage/profileHeading.d.ts.map +1 -1
  113. package/dist/mainPage/profileHeading2.cjs.js +1 -1
  114. package/dist/mainPage/profileHeading2.cjs.js.map +1 -1
  115. package/dist/mainPage/profileHeading2.esm.js +14 -14
  116. package/dist/mainPage/profileHeading2.esm.js.map +1 -1
  117. package/dist/n3Pane.d.ts.map +1 -1
  118. package/dist/n3Pane2.cjs.js +1 -1
  119. package/dist/n3Pane2.cjs.js.map +1 -1
  120. package/dist/n3Pane2.esm.js +1 -1
  121. package/dist/n3Pane2.esm.js.map +1 -1
  122. package/dist/navigation/browserEvents.cjs.js +1 -1
  123. package/dist/navigation/browserEvents.cjs.js.map +1 -1
  124. package/dist/navigation/browserEvents.d.ts.map +1 -1
  125. package/dist/navigation/browserEvents.esm.js +17 -17
  126. package/dist/navigation/browserEvents.esm.js.map +1 -1
  127. package/dist/navigation/chrome.cjs.js +1 -1
  128. package/dist/navigation/chrome.cjs.js.map +1 -1
  129. package/dist/navigation/chrome.d.ts +2 -2
  130. package/dist/navigation/chrome.d.ts.map +1 -1
  131. package/dist/navigation/chrome.esm.js +2 -2
  132. package/dist/navigation/chrome.esm.js.map +1 -1
  133. package/dist/navigation/controller.cjs.js +1 -1
  134. package/dist/navigation/controller.cjs.js.map +1 -1
  135. package/dist/navigation/controller.esm.js +37 -37
  136. package/dist/navigation/podContext.cjs.js +1 -1
  137. package/dist/navigation/podContext.cjs.js.map +1 -1
  138. package/dist/navigation/podContext.esm.js +5 -5
  139. package/dist/navigation/state.cjs.js +1 -1
  140. package/dist/navigation/state.cjs.js.map +1 -1
  141. package/dist/navigation/state.d.ts +4 -0
  142. package/dist/navigation/state.d.ts.map +1 -1
  143. package/dist/navigation/state.esm.js +18 -5
  144. package/dist/navigation/state.esm.js.map +1 -1
  145. package/dist/outline/fileExplorerHelpers.cjs.js +1 -1
  146. package/dist/outline/fileExplorerHelpers.cjs.js.map +1 -1
  147. package/dist/outline/fileExplorerHelpers.d.ts +2 -5
  148. package/dist/outline/fileExplorerHelpers.d.ts.map +1 -1
  149. package/dist/outline/fileExplorerHelpers.esm.js +11 -13
  150. package/dist/outline/fileExplorerHelpers.esm.js.map +1 -1
  151. package/dist/outline/manager2.cjs.js +1 -1
  152. package/dist/outline/manager2.cjs.js.map +1 -1
  153. package/dist/outline/manager2.esm.js +355 -327
  154. package/dist/outline/manager2.esm.js.map +1 -1
  155. package/dist/registerPanes.cjs.js +1 -1
  156. package/dist/registerPanes.cjs.js.map +1 -1
  157. package/dist/registerPanes.esm.js +1 -1
  158. package/dist/registerPanes.esm.js.map +1 -1
  159. package/dist/slideshow/slideshowPane.cjs.js +1 -1
  160. package/dist/slideshow/slideshowPane.cjs.js.map +1 -1
  161. package/dist/slideshow/slideshowPane.esm.js +30 -30
  162. package/dist/slideshow/slideshowPane.esm.js.map +1 -1
  163. package/dist/social/socialPane2.cjs.js +1 -1
  164. package/dist/social/socialPane2.esm.js +1 -1
  165. package/dist/social/socialSections.cjs.js +1 -1
  166. package/dist/social/socialSections.esm.js +1 -1
  167. package/dist/utils/paneUtils.cjs.js +1 -1
  168. package/dist/utils/paneUtils.cjs.js.map +1 -1
  169. package/dist/utils/paneUtils.esm.js +15 -15
  170. package/dist/versionInfo.cjs.js +1 -1
  171. package/dist/versionInfo.cjs.js.map +1 -1
  172. package/dist/versionInfo.esm.js +9 -9
  173. package/dist/versionInfo.esm.js.map +1 -1
  174. package/package.json +11 -12
@@ -1 +1 @@
1
- {"version":3,"file":"HeadingEditDialog.esm.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","HEADING_PHONE_TYPE_OPTIONS","HEADING_EMAIL_TYPE_OPTIONS","HEADING_PRONOUN_OPTIONS","isContactPointRow","row","isAddressRow","isProfileBasicRow","normalizeHeadingContactTypeValue","options","option","value","getHeadingContactTypeOptions","kind","withDefaultHeadingContactType","rowHasContent","hasNonEmptyText","normalizePronounsValue","normalized","sanitizeTextValue","toFormState","basicInfo","toText","profileData","primaryEmail","primaryPhone","primaryAddress","emailTypeWasMissing","normalizeEmailTypeForEdit","phoneTypeWasMissing","normalizePhoneTypeForEdit","normalizedEmailType","normalizedPhoneType","email","sanitizeEmailValue","phone","address","sanitizeAddressFieldValue","toTypeLabel","setHeadingImagePreview","formState","previewUrl","file","setResolvedHeadingPreview","resolvedImageSrc","mapEmailOpsForSave","mapRow","toSavedHeadingEmailType","ops","mapPhoneOpsForSave","toSavedHeadingPhoneType","summarizeHeadingContactOps","summarizeRowOps","typeWasMissing","renderContactPhoneInput","label","typeLabel","inputName","splitValue","splitPhoneValue","selectedDialCode","target","e","nextValue","sanitizePhoneLocalValue","applyRowFieldChange","combinePhoneValue","event","nextType","applyRowSelectChange","renderContactEmailInputRow","renderContactAddressInput","handleAddressInput","field","renderHeadingInfoInput","nameLabel","nicknameLabel","pronounsLabel","handleBasicInfoInput","sanitizeBasicInputFieldValue","Image","imagePreviewSrc","rerender","error","dom","fileInput","cleanupFileInput","toStorageDateISO","renderHeadingEditTemplate","form","viewerMode","ownerLoginRequiredDialogMessageText","createHeadingEditForm","isValidHeadingEmailAddress","isValidHeadingPhoneNumber","validateHeadingDataBeforeSave","localNumber","createHeadingEditDialog","originalPhotoUri","resolvePhotoDisplaySrc","store","openInputDialog","basicInfoOps","phoneOps","emailOps","addressOps","uploadedUri","uploadPhotoFile","subject","plan","processHeadingMutations","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":";;;;;;;;;;;;;;;;;;;;AAmEA,IAAM+B,IAAyD;CAC7D;EAAEC,OAAO;EAAUC,OAAO;CAAS;CACnC;EAAED,OAAO;EAAQC,OAAO;CAAO;CAC/B;EAAED,OAAO;EAAQC,OAAO;CAAO;AAAC,GAG5BC,IAAyD,CAC7D;CAAEF,OAAO;CAA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mBsF,CAAQ;IACrCC,UAAU9F,EAAmB8F,CAAQ;IACrCC,YAAY9K,EAAgB,CAACuE,EAAUL,OAAO,GAAG/B,CAAa;GAChE;GACA,MAAM5C,EAAwB0K,GAAOC,GAASgB,CAAI;GAElD,IAAME,IAAelL,EAAkBqE,EAAUlB,UAAUV,YAAY,EAAE;GACzE,IAAIyH,KAAoBA,MAAqBgB,GAC3C,IAAI;IACFrK,EAAkCqJ,CAAgB;GACpD,SAASzB,GAAO;IACdC,QAAQyC,KAAK,6CAA6C1C,CAAK;GACjE;EAEJ;EACA2C,kBAAkB3C,MACTA,aAAiB4C,QAAQ5C,EAAM6C,UAAAA;CAE1C,CAAC,KAMGrB,KACF,MAAMA,EAAQ;AAElB"}
1
+ {"version":3,"file":"HeadingEditDialog.esm.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","HEADING_PHONE_TYPE_OPTIONS","HEADING_EMAIL_TYPE_OPTIONS","HEADING_PRONOUN_OPTIONS","isContactPointRow","row","isAddressRow","isProfileBasicRow","normalizeHeadingContactTypeValue","options","option","value","getHeadingContactTypeOptions","kind","withDefaultHeadingContactType","rowHasContent","hasNonEmptyText","normalizePronounsValue","normalized","sanitizeTextValue","toFormState","basicInfo","toText","profileData","primaryEmail","primaryPhone","primaryAddress","emailTypeWasMissing","normalizeEmailTypeForEdit","phoneTypeWasMissing","normalizePhoneTypeForEdit","normalizedEmailType","normalizedPhoneType","email","sanitizeEmailValue","phone","address","sanitizeAddressFieldValue","toTypeLabel","setHeadingImagePreview","formState","previewUrl","file","setResolvedHeadingPreview","resolvedImageSrc","mapEmailOpsForSave","mapRow","toSavedHeadingEmailType","ops","mapPhoneOpsForSave","toSavedHeadingPhoneType","summarizeHeadingContactOps","summarizeRowOps","typeWasMissing","renderContactPhoneInput","label","typeLabel","inputName","splitValue","splitPhoneValue","selectedDialCode","target","e","nextValue","sanitizePhoneLocalValue","applyRowFieldChange","combinePhoneValue","event","nextType","applyRowSelectChange","renderContactEmailInputRow","renderContactAddressInput","handleAddressInput","field","renderHeadingInfoInput","nameLabel","nicknameLabel","pronounsLabel","handleBasicInfoInput","sanitizeBasicInputFieldValue","Image","imagePreviewSrc","rerender","error","dom","fileInput","cleanupFileInput","toStorageDateISO","renderHeadingEditTemplate","form","viewerMode","ownerLoginRequiredDialogMessageText","createHeadingEditForm","isValidHeadingEmailAddress","isValidHeadingPhoneNumber","validateHeadingDataBeforeSave","localNumber","createHeadingEditDialog","originalPhotoUri","resolvePhotoDisplaySrc","store","openInputDialog","basicInfoOps","phoneOps","emailOps","addressOps","uploadedUri","uploadPhotoFile","subject","plan","processHeadingMutations","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":";;;;;;;;;;;;;;;;;;;;AAmEA,IAAM2B,IAAyD;CAC7D;EAAEC,OAAO;EAAUC,OAAO;CAAS;CACnC;EAAED,OAAO;EAAQC,OAAO;CAAO;CAC/B;EAAED,OAAO;EAAQC,OAAO;CAAO;AAAC,GAG5BC,IAAyD,CAC7D;CAAEF,OAAO;CAAYC,OAAO;AAAW,GACvC;CAAED,OAAO;CAAUC,OAAO;AAAS,CAAC,GAGhCE,IAAmD;CACvD;EAAEH,OAAO;EAAUC,OAAO;CAAS;CACnC;EAAED,OAAO;EAAWC,OAAO;CAAU;CACrC;EAAED,OAAO;EAAaC,OAAO;CAAY;AAAC;AAK5C,SAASG,EAAmBC,GAAkC;CAC5D,OAAO,WAAWA;AACpB;AAEA,SAASC,EAAcD,GAAoC;CACzD,OAAO,mBAAmBA;A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IACdC,QAAQyC,KAAK,6CAA6C1C,CAAK;GACjE;EAEJ;EACA2C,kBAAkB3C,MACTA,aAAiB4C,QAAQ5C,EAAM6C,UAAAA;CAE1C,CAAC,KAMGrB,KACF,MAAMA,EAAQ;AAElB"}
@@ -1 +1 @@
1
- {"version":3,"file":"dateHelpers.cjs.js","names":["normalizeDmy","value","dmyMatch","match","day","month","year","toDisplayDateDMY","emptyFallback","raw","trim","isoMatch","normalizedDmy","toEditableDateDMY","toStorageDateISO","toStorageDateISO","raw","value","dmyMatch","day","month","year"],"sources":["../../../../../../src/components/profile-heading/editor/sections/heading/dateHelpers.ts"],"sourcesContent":["function normalizeDmy (value: string): string {\n const dmyMatch = value.match(/^(\\d{2})[/-](\\d{2})[/-](\\d{4})$/)\n if (!dmyMatch) return ''\n\n const [, day, month, year] = dmyMatch\n return `${day}-${month}-${year}`\n}\n\nexport function toDisplayDateDMY (value: string | undefined, emptyFallback = ''): string {\n const raw = (value || '').trim()\n if (!raw) return emptyFallback\n\n const isoMatch = raw.match(/^(\\d{4})-(\\d{2})-(\\d{2})/)\n if (isoMatch) {\n const [, year, month, day] = isoMatch\n return `${day}-${month}-${year}`\n }\n\n const normalizedDmy = normalizeDmy(raw)\n if (normalizedDmy) return normalizedDmy\n\n return raw\n}\n\nexport function toEditableDateDMY (value: string | undefined): string {\n const raw = (value || '').trim()\n if (!raw) return ''\n\n const isoMatch = raw.match(/^(\\d{4})-(\\d{2})-(\\d{2})$/)\n if (isoMatch) {\n const [, year, month, day] = isoMatch\n return `${day}-${month}-${year}`\n }\n\n return normalizeDmy(raw)\n}\n\nexport function toStorageDateISO (value: string | undefined): string {\n const raw = (value || '').trim()\n if (!raw) return ''\n\n const isoMatch = raw.match(/^(\\d{4})-(\\d{2})-(\\d{2})$/)\n if (isoMatch) return raw\n\n const dmyMatch = raw.match(/^(\\d{2})[/-](\\d{2})[/-](\\d{4})$/)\n if (dmyMatch) {\n const [, day, month, year] = dmyMatch\n return `${year}-${month}-${day}`\n }\n\n return ''\n}\n"],"mappings":"AAqCA,SAAgBc,EAAkBb,EAAmC,CACnE,IAAMQ,GAAOR,GAAS,GAAA,CAAIS,KAAK,EAC/B,GAAI,CAACD,EAAK,MAAO,GAGjB,GADiBA,EAAIN,MAAM,2BACvBQ,EAAU,OAAOF,EAErB,IAAMP,EAAWO,EAAIN,MAAM,iCAAiC,EAC5D,GAAID,EAAU,CACZ,GAAM,EAAGE,EAAKC,EAAOC,GAAQJ,EAC7B,MAAO,GAAGI,EAAI,GAAID,EAAK,GAAID,GAC7B,CAEA,MAAO,EACT,C"}
1
+ {"version":3,"file":"dateHelpers.cjs.js","names":["value","dmyMatch","match","day","month","year","raw","trim","isoMatch","toStorageDateISO","toStorageDateISO","raw","value","dmyMatch","day","month","year"],"sources":["../../../../../../src/components/profile-heading/editor/sections/heading/dateHelpers.ts"],"sourcesContent":["function normalizeDmy (value: string): string {\n const dmyMatch = value.match(/^(\\d{2})[/-](\\d{2})[/-](\\d{4})$/)\n if (!dmyMatch) return ''\n\n const [, day, month, year] = dmyMatch\n return `${day}-${month}-${year}`\n}\n\nexport function toDisplayDateDMY (value: string | undefined, emptyFallback = ''): string {\n const raw = (value || '').trim()\n if (!raw) return emptyFallback\n\n const isoMatch = raw.match(/^(\\d{4})-(\\d{2})-(\\d{2})/)\n if (isoMatch) {\n const [, year, month, day] = isoMatch\n return `${day}-${month}-${year}`\n }\n\n const normalizedDmy = normalizeDmy(raw)\n if (normalizedDmy) return normalizedDmy\n\n return raw\n}\n\nexport function toEditableDateDMY (value: string | undefined): string {\n const raw = (value || '').trim()\n if (!raw) return ''\n\n const isoMatch = raw.match(/^(\\d{4})-(\\d{2})-(\\d{2})$/)\n if (isoMatch) {\n const [, year, month, day] = isoMatch\n return `${day}-${month}-${year}`\n }\n\n return normalizeDmy(raw)\n}\n\nexport function toStorageDateISO (value: string | undefined): string {\n const raw = (value || '').trim()\n if (!raw) return ''\n\n const isoMatch = raw.match(/^(\\d{4})-(\\d{2})-(\\d{2})$/)\n if (isoMatch) return raw\n\n const dmyMatch = raw.match(/^(\\d{2})[/-](\\d{2})[/-](\\d{4})$/)\n if (dmyMatch) {\n const [, day, month, year] = dmyMatch\n return `${year}-${month}-${day}`\n }\n\n return ''\n}\n"],"mappings":"AAqCA,SAAgBS,EAAkBT,EAAmC,CACnE,IAAMM,GAAON,GAAS,GAAA,CAAIO,KAAK,EAC/B,GAAI,CAACD,EAAK,MAAO,GAGjB,GADiBA,EAAIJ,MAAM,2BACvBM,EAAU,OAAOF,EAErB,IAAML,EAAWK,EAAIJ,MAAM,iCAAiC,EAC5D,GAAID,EAAU,CACZ,GAAM,EAAGE,EAAKC,EAAOC,GAAQJ,EAC7B,MAAO,GAAGI,EAAI,GAAID,EAAK,GAAID,GAC7B,CAEA,MAAO,EACT,C"}
@@ -1 +1 @@
1
- {"version":3,"file":"dateHelpers.esm.js","names":["normalizeDmy","value","dmyMatch","match","day","month","year","toDisplayDateDMY","emptyFallback","raw","trim","isoMatch","normalizedDmy","toEditableDateDMY","toStorageDateISO","toStorageDateISO","raw","value","dmyMatch","day","month","year"],"sources":["../../../../../../src/components/profile-heading/editor/sections/heading/dateHelpers.ts"],"sourcesContent":["function normalizeDmy (value: string): string {\n const dmyMatch = value.match(/^(\\d{2})[/-](\\d{2})[/-](\\d{4})$/)\n if (!dmyMatch) return ''\n\n const [, day, month, year] = dmyMatch\n return `${day}-${month}-${year}`\n}\n\nexport function toDisplayDateDMY (value: string | undefined, emptyFallback = ''): string {\n const raw = (value || '').trim()\n if (!raw) return emptyFallback\n\n const isoMatch = raw.match(/^(\\d{4})-(\\d{2})-(\\d{2})/)\n if (isoMatch) {\n const [, year, month, day] = isoMatch\n return `${day}-${month}-${year}`\n }\n\n const normalizedDmy = normalizeDmy(raw)\n if (normalizedDmy) return normalizedDmy\n\n return raw\n}\n\nexport function toEditableDateDMY (value: string | undefined): string {\n const raw = (value || '').trim()\n if (!raw) return ''\n\n const isoMatch = raw.match(/^(\\d{4})-(\\d{2})-(\\d{2})$/)\n if (isoMatch) {\n const [, year, month, day] = isoMatch\n return `${day}-${month}-${year}`\n }\n\n return normalizeDmy(raw)\n}\n\nexport function toStorageDateISO (value: string | undefined): string {\n const raw = (value || '').trim()\n if (!raw) return ''\n\n const isoMatch = raw.match(/^(\\d{4})-(\\d{2})-(\\d{2})$/)\n if (isoMatch) return raw\n\n const dmyMatch = raw.match(/^(\\d{2})[/-](\\d{2})[/-](\\d{4})$/)\n if (dmyMatch) {\n const [, day, month, year] = dmyMatch\n return `${year}-${month}-${day}`\n }\n\n return ''\n}\n"],"mappings":";AAqCA,SAAgBc,EAAkBb,GAAmC;CACnE,IAAMQ,KAAOR,KAAS,GAAA,CAAIS,KAAK;CAC/B,IAAI,CAACD,GAAK,OAAO;CAGjB,IADiBA,EAAIN,MAAM,2BACvBQ,GAAU,OAAOF;CAErB,IAAMP,IAAWO,EAAIN,MAAM,iCAAiC;CAC5D,IAAID,GAAU;EACZ,IAAM,GAAGE,GAAKC,GAAOC,KAAQJ;EAC7B,OAAO,GAAGI,EAAI,GAAID,EAAK,GAAID;CAC7B;CAEA,OAAO;AACT"}
1
+ {"version":3,"file":"dateHelpers.esm.js","names":["value","dmyMatch","match","day","month","year","raw","trim","isoMatch","toStorageDateISO","toStorageDateISO","raw","value","dmyMatch","day","month","year"],"sources":["../../../../../../src/components/profile-heading/editor/sections/heading/dateHelpers.ts"],"sourcesContent":["function normalizeDmy (value: string): string {\n const dmyMatch = value.match(/^(\\d{2})[/-](\\d{2})[/-](\\d{4})$/)\n if (!dmyMatch) return ''\n\n const [, day, month, year] = dmyMatch\n return `${day}-${month}-${year}`\n}\n\nexport function toDisplayDateDMY (value: string | undefined, emptyFallback = ''): string {\n const raw = (value || '').trim()\n if (!raw) return emptyFallback\n\n const isoMatch = raw.match(/^(\\d{4})-(\\d{2})-(\\d{2})/)\n if (isoMatch) {\n const [, year, month, day] = isoMatch\n return `${day}-${month}-${year}`\n }\n\n const normalizedDmy = normalizeDmy(raw)\n if (normalizedDmy) return normalizedDmy\n\n return raw\n}\n\nexport function toEditableDateDMY (value: string | undefined): string {\n const raw = (value || '').trim()\n if (!raw) return ''\n\n const isoMatch = raw.match(/^(\\d{4})-(\\d{2})-(\\d{2})$/)\n if (isoMatch) {\n const [, year, month, day] = isoMatch\n return `${day}-${month}-${year}`\n }\n\n return normalizeDmy(raw)\n}\n\nexport function toStorageDateISO (value: string | undefined): string {\n const raw = (value || '').trim()\n if (!raw) return ''\n\n const isoMatch = raw.match(/^(\\d{4})-(\\d{2})-(\\d{2})$/)\n if (isoMatch) return raw\n\n const dmyMatch = raw.match(/^(\\d{2})[/-](\\d{2})[/-](\\d{4})$/)\n if (dmyMatch) {\n const [, day, month, year] = dmyMatch\n return `${year}-${month}-${day}`\n }\n\n return ''\n}\n"],"mappings":";AAqCA,SAAgBS,EAAkBT,GAAmC;CACnE,IAAMM,KAAON,KAAS,GAAA,CAAIO,KAAK;CAC/B,IAAI,CAACD,GAAK,OAAO;CAGjB,IADiBA,EAAIJ,MAAM,2BACvBM,GAAU,OAAOF;CAErB,IAAML,IAAWK,EAAIJ,MAAM,iCAAiC;CAC5D,IAAID,GAAU;EACZ,IAAM,GAAGE,GAAKC,GAAOC,KAAQJ;EAC7B,OAAO,GAAGI,EAAI,GAAID,EAAK,GAAID;CAC7B;CAEA,OAAO;AACT"}
@@ -1 +1 @@
1
- {"version":3,"file":"imageHelpers.cjs.js","names":["sym","ns","authn","solidLogicSingleton","resolvedHeadingImageCache","Map","invalidateResolvedPhotoDisplaySrc","imageSrc","cachedImageSrc","get","delete","startsWith","URL","revokeObjectURL","mimeMap","extMap","Object","fromEntries","entries","map","contentType","extension","mime","lookup","filename","ext","split","pop","toLowerCase","subjectDirectoryUri","subject","docUri","doc","uri","lastSlash","lastIndexOf","slice","resolvePhotoDisplaySrc","store","fetcher","_fetch","createObjectURL","response","ok","imageBlob","blob","resolvedImageSrc","set","uploadPhotoFile","file","Error","detectedContentType","type","name","size","encodeURIComponent","directoryUri","candidateUri","index","holds","vcard","fallbackName","data","arrayBuffer","webOperation","status","statusText","error","currentUser","acl","setACLUserPublic","public","console","ns","sym","authn","solidLogicSingleton","solid_ui","solid_logic","rdflib","resolvedHeadingImageCache","invalidateResolvedPhotoDisplaySrc","imageSrc","cachedImageSrc","mimeMap","extMap","contentType","extension","mime","filename","subjectDirectoryUri","docUri","subject","lastSlash","resolvePhotoDisplaySrc","fetcher","store","response","imageBlob","resolvedImageSrc","uploadPhotoFile","detectedContentType","file","directoryUri","candidateUri","index","data","error","currentUser"],"sources":["../../../../../../src/components/profile-heading/editor/sections/heading/imageHelpers.ts"],"sourcesContent":["import { LiveStore, NamedNode, sym } from 'rdflib'\nimport { ns } from 'solid-ui'\nimport { authn, solidLogicSingleton } from 'solid-logic'\n\nconst resolvedHeadingImageCache = new Map<string, string>()\n\nexport function invalidateResolvedPhotoDisplaySrc (imageSrc?: string): void {\n if (!imageSrc) return\n\n const cachedImageSrc = resolvedHeadingImageCache.get(imageSrc)\n if (!cachedImageSrc) return\n\n resolvedHeadingImageCache.delete(imageSrc)\n if (cachedImageSrc.startsWith('blob:') && typeof URL.revokeObjectURL === 'function') {\n URL.revokeObjectURL(cachedImageSrc)\n }\n}\n/* Code copied from contact-pane/src/mugshotGallery and modified to fit the needs of the new design */\nconst mimeMap: Record<string, string> = {\n 'image/png': 'png',\n 'image/jpeg': 'jpg',\n 'image/gif': 'gif',\n 'image/svg+xml': 'svg',\n 'image/webp': 'webp',\n 'image/bmp': 'bmp',\n 'image/tiff': 'tiff',\n 'application/pdf': 'pdf',\n 'text/plain': 'txt',\n 'text/html': 'html',\n 'application/json': 'json',\n 'application/octet-stream': 'bin'\n}\n\nconst extMap = Object.fromEntries(\n Object.entries(mimeMap).map(([contentType, extension]) => [extension, contentType])\n) as Record<string, string>\n\nconst mime = {\n extension: (contentType: string): string | false => mimeMap[contentType] || false,\n lookup: (filename: string): string | false => {\n const ext = filename.split('.').pop()?.toLowerCase() || ''\n return extMap[ext] || false\n }\n}\n\nfunction subjectDirectoryUri (subject: NamedNode): string {\n const docUri = subject.doc().uri\n const lastSlash = docUri.lastIndexOf('/')\n return lastSlash >= 0 ? docUri.slice(0, lastSlash + 1) : docUri\n}\n\nexport async function resolvePhotoDisplaySrc (store: LiveStore, imageSrc?: string): Promise<string | undefined> {\n if (!imageSrc || imageSrc.startsWith('blob:') || imageSrc.startsWith('data:')) {\n return imageSrc\n }\n\n const cachedImageSrc = resolvedHeadingImageCache.get(imageSrc)\n if (cachedImageSrc) {\n return cachedImageSrc\n }\n\n const fetcher = store.fetcher as { _fetch?: (url: string) => Promise<Response> } | undefined\n if (!fetcher?._fetch || typeof URL.createObjectURL !== 'function') {\n return imageSrc\n }\n\n try {\n const response = await fetcher._fetch(imageSrc)\n if (!response.ok) {\n return imageSrc\n }\n\n const imageBlob = await response.blob()\n const resolvedImageSrc = URL.createObjectURL(imageBlob)\n resolvedHeadingImageCache.set(imageSrc, resolvedImageSrc)\n return resolvedImageSrc\n } catch {\n return imageSrc\n }\n}\n\nexport async function uploadPhotoFile (store: LiveStore, subject: NamedNode, file: File): Promise<string> {\n if (!store.fetcher) {\n throw new Error('Store has no fetcher.')\n }\n\n const detectedContentType = file.type || mime.lookup(file.name) || 'application/octet-stream'\n if (!detectedContentType.startsWith('image/')) {\n throw new Error('Selected file is not an image.')\n }\n if (file.size > 2 * 1024 * 1024) {\n throw new Error('Selected image must be 2 MB or smaller.')\n }\n\n const extension = mime.extension(detectedContentType) || 'bin'\n let filename = encodeURIComponent(file.name || `image.${extension}`)\n\n if (detectedContentType !== mime.lookup(file.name || '')) {\n filename += `_.${extension}`\n }\n\n const directoryUri = subjectDirectoryUri(subject)\n let candidateUri = `${directoryUri}${filename}`\n\n for (let index = 0; store.holds(subject, ns.vcard('hasPhoto'), sym(candidateUri)); index++) {\n const fallbackName = `image_${index}.${extension}`\n candidateUri = `${directoryUri}${fallbackName}`\n }\n try {\n const data = await file.arrayBuffer()\n const response = await store.fetcher.webOperation('PUT', candidateUri, {\n data: data as unknown as string,\n contentType: detectedContentType\n } as any)\n if (!response.ok) {\n throw new Error(`Error uploading picture: ${response.status} ${response.statusText}`)\n }\n } catch (error) {\n throw new Error(`Error uploading picture: ${error}`)\n }\n\n const currentUser = authn.currentUser()\n if (currentUser) {\n try {\n await solidLogicSingleton.acl.setACLUserPublic(candidateUri, currentUser, {\n public: ['Read'] as unknown as []\n })\n } catch (error) {\n console.error(`Error setting uploaded picture permissions: ${error}`)\n }\n }\n\n return candidateUri\n}\n"],"mappings":"A,uEAIA,IAAMI,EAA4B,IAAIC,IAEtC,SAAgBC,EAAmCC,EAAyB,CAC1E,GAAI,CAACA,EAAU,OAEf,IAAMC,EAAiBJ,EAA0BK,IAAIF,CAAQ,EACxDC,IAELJ,EAA0BM,OAAOH,CAAQ,EACrCC,EAAeG,WAAW,OAAO,GAAK,OAAOC,IAAIC,iBAAoB,YACvED,IAAIC,gBAAgBL,CAAc,EAEtC,CAEA,IAAMM,EAAkC,CACtC,YAAa,MACb,aAAc,MACd,YAAa,MACb,gBAAiB,MACjB,aAAc,OACd,YAAa,MACb,aAAc,OACd,kBAAmB,MACnB,aAAc,MACd,YAAa,OACb,mBAAoB,OACpB,2BAA4B,KAC9B,EAEMC,EAASC,OAAOC,YACpBD,OAAOE,QAAQJ,CAAO,CAAC,CAACK,KAAK,CAACC,EAAaC,KAAe,CAACA,EAAWD,CAAW,CAAC,CACpF,EAEME,EAAO,CACXD,UAAYD,GAAwCN,EAAQM,IAAgB,GAC5EG,OAASC,GAEAT,EADKS,EAASE,MAAM,GAAG,CAAC,CAACC,IAAI,CAAC,EAAEC,YAAY,GAAK,KAClC,EAE1B,EAEA,SAASC,EAAqBC,EAA4B,CACxD,IAAMC,EAASD,EAAQE,IAAI,CAAC,CAACC,IACvBC,EAAYH,EAAOI,YAAY,GAAG,EACxC,OAAOD,GAAa,EAAIH,EAAOK,MAAM,EAAGF,EAAY,CAAC,EAAIH,CAC3D,CAEA,eAAsBM,EAAw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Y,CAAC,EAAGC,IAEjFD,EAAe,GAAGD,IAAeK,SADHH,EAAK,GAAIrC,MAGzC,GAAI,CACF,IAAMyC,EAAO,MAAMb,EAAKc,YAAY,EAC9BrB,EAAW,MAAMJ,EAAMC,QAAQyB,aAAa,MAAOP,EAAc,CAC/DK,OACN1C,YAAa+B,CACf,CAAQ,EACR,GAAI,CAACT,EAASC,GACZ,MAAUO,MAAM,4BAA4BR,EAASuB,OAAM,GAAIvB,EAASwB,YAAY,CAExF,OAASC,EAAO,CACd,MAAUjB,MAAM,4BAA4BiB,GAAO,CACrD,CAEA,IAAMC,EAAclE,EAAAA,MAAMkE,YAAY,EACtC,GAAIA,EACF,GAAI,CACF,MAAMjE,EAAAA,oBAAoBkE,IAAIC,iBAAiBb,EAAcW,EAAa,CACxEG,OAAQ,CAAC,MAAM,CACjB,CAAC,CACH,OAASJ,EAAO,CACdK,QAAQL,MAAM,+CAA+CA,GAAO,CACtE,CAGF,OAAOV,CACT,C"}
1
+ {"version":3,"file":"imageHelpers.cjs.js","names":["sym","ns","authn","solidLogicSingleton","resolvedHeadingImageCache","Map","invalidateResolvedPhotoDisplaySrc","imageSrc","cachedImageSrc","get","delete","startsWith","URL","revokeObjectURL","mimeMap","extMap","Object","fromEntries","entries","map","contentType","extension","mime","lookup","filename","ext","split","pop","toLowerCase","subjectDirectoryUri","subject","docUri","doc","uri","lastSlash","lastIndexOf","slice","resolvePhotoDisplaySrc","store","fetcher","_fetch","createObjectURL","response","ok","imageBlob","blob","resolvedImageSrc","set","uploadPhotoFile","file","Error","detectedContentType","type","name","size","encodeURIComponent","directoryUri","candidateUri","index","holds","vcard","fallbackName","data","arrayBuffer","webOperation","status","statusText","error","currentUser","acl","setACLUserPublic","public","console","solid_ui","solid_logic","rdflib","resolvedHeadingImageCache","invalidateResolvedPhotoDisplaySrc","imageSrc","cachedImageSrc","mimeMap","extMap","contentType","extension","mime","filename","subjectDirectoryUri","docUri","subject","lastSlash","resolvePhotoDisplaySrc","fetcher","store","response","imageBlob","resolvedImageSrc","uploadPhotoFile","detectedContentType","file","directoryUri","candidateUri","index","data","error","currentUser"],"sources":["../../../../../../src/components/profile-heading/editor/sections/heading/imageHelpers.ts"],"sourcesContent":["import { LiveStore, NamedNode, sym } from 'rdflib'\nimport { ns } from 'solid-ui'\nimport { authn, solidLogicSingleton } from 'solid-logic'\n\nconst resolvedHeadingImageCache = new Map<string, string>()\n\nexport function invalidateResolvedPhotoDisplaySrc (imageSrc?: string): void {\n if (!imageSrc) return\n\n const cachedImageSrc = resolvedHeadingImageCache.get(imageSrc)\n if (!cachedImageSrc) return\n\n resolvedHeadingImageCache.delete(imageSrc)\n if (cachedImageSrc.startsWith('blob:') && typeof URL.revokeObjectURL === 'function') {\n URL.revokeObjectURL(cachedImageSrc)\n }\n}\n/* Code copied from contact-pane/src/mugshotGallery and modified to fit the needs of the new design */\nconst mimeMap: Record<string, string> = {\n 'image/png': 'png',\n 'image/jpeg': 'jpg',\n 'image/gif': 'gif',\n 'image/svg+xml': 'svg',\n 'image/webp': 'webp',\n 'image/bmp': 'bmp',\n 'image/tiff': 'tiff',\n 'application/pdf': 'pdf',\n 'text/plain': 'txt',\n 'text/html': 'html',\n 'application/json': 'json',\n 'application/octet-stream': 'bin'\n}\n\nconst extMap = Object.fromEntries(\n Object.entries(mimeMap).map(([contentType, extension]) => [extension, contentType])\n) as Record<string, string>\n\nconst mime = {\n extension: (contentType: string): string | false => mimeMap[contentType] || false,\n lookup: (filename: string): string | false => {\n const ext = filename.split('.').pop()?.toLowerCase() || ''\n return extMap[ext] || false\n }\n}\n\nfunction subjectDirectoryUri (subject: NamedNode): string {\n const docUri = subject.doc().uri\n const lastSlash = docUri.lastIndexOf('/')\n return lastSlash >= 0 ? docUri.slice(0, lastSlash + 1) : docUri\n}\n\nexport async function resolvePhotoDisplaySrc (store: LiveStore, imageSrc?: string): Promise<string | undefined> {\n if (!imageSrc || imageSrc.startsWith('blob:') || imageSrc.startsWith('data:')) {\n return imageSrc\n }\n\n const cachedImageSrc = resolvedHeadingImageCache.get(imageSrc)\n if (cachedImageSrc) {\n return cachedImageSrc\n }\n\n const fetcher = store.fetcher as { _fetch?: (url: string) => Promise<Response> } | undefined\n if (!fetcher?._fetch || typeof URL.createObjectURL !== 'function') {\n return imageSrc\n }\n\n try {\n const response = await fetcher._fetch(imageSrc)\n if (!response.ok) {\n return imageSrc\n }\n\n const imageBlob = await response.blob()\n const resolvedImageSrc = URL.createObjectURL(imageBlob)\n resolvedHeadingImageCache.set(imageSrc, resolvedImageSrc)\n return resolvedImageSrc\n } catch {\n return imageSrc\n }\n}\n\nexport async function uploadPhotoFile (store: LiveStore, subject: NamedNode, file: File): Promise<string> {\n if (!store.fetcher) {\n throw new Error('Store has no fetcher.')\n }\n\n const detectedContentType = file.type || mime.lookup(file.name) || 'application/octet-stream'\n if (!detectedContentType.startsWith('image/')) {\n throw new Error('Selected file is not an image.')\n }\n if (file.size > 2 * 1024 * 1024) {\n throw new Error('Selected image must be 2 MB or smaller.')\n }\n\n const extension = mime.extension(detectedContentType) || 'bin'\n let filename = encodeURIComponent(file.name || `image.${extension}`)\n\n if (detectedContentType !== mime.lookup(file.name || '')) {\n filename += `_.${extension}`\n }\n\n const directoryUri = subjectDirectoryUri(subject)\n let candidateUri = `${directoryUri}${filename}`\n\n for (let index = 0; store.holds(subject, ns.vcard('hasPhoto'), sym(candidateUri)); index++) {\n const fallbackName = `image_${index}.${extension}`\n candidateUri = `${directoryUri}${fallbackName}`\n }\n try {\n const data = await file.arrayBuffer()\n const response = await store.fetcher.webOperation('PUT', candidateUri, {\n data: data as unknown as string,\n contentType: detectedContentType\n } as any)\n if (!response.ok) {\n throw new Error(`Error uploading picture: ${response.status} ${response.statusText}`)\n }\n } catch (error) {\n throw new Error(`Error uploading picture: ${error}`)\n }\n\n const currentUser = authn.currentUser()\n if (currentUser) {\n try {\n await solidLogicSingleton.acl.setACLUserPublic(candidateUri, currentUser, {\n public: ['Read'] as unknown as []\n })\n } catch (error) {\n console.error(`Error setting uploaded picture permissions: ${error}`)\n }\n }\n\n return candidateUri\n}\n"],"mappings":"A,uEAIA,IAAMI,EAA4B,IAAIC,IAEtC,SAAgBC,EAAmCC,EAAyB,CAC1E,GAAI,CAACA,EAAU,OAEf,IAAMC,EAAiBJ,EAA0BK,IAAIF,CAAQ,EACxDC,IAELJ,EAA0BM,OAAOH,CAAQ,EACrCC,EAAeG,WAAW,OAAO,GAAK,OAAOC,IAAIC,iBAAoB,YACvED,IAAIC,gBAAgBL,CAAc,EAEtC,CAEA,IAAMM,EAAkC,CACtC,YAAa,MACb,aAAc,MACd,YAAa,MACb,gBAAiB,MACjB,aAAc,OACd,YAAa,MACb,aAAc,OACd,kBAAmB,MACnB,aAAc,MACd,YAAa,OACb,mBAAoB,OACpB,2BAA4B,KAC9B,EAEMC,EAASC,OAAOC,YACpBD,OAAOE,QAAQJ,CAAO,CAAC,CAACK,KAAK,CAACC,EAAaC,KAAe,CAACA,EAAWD,CAAW,CAAC,CACpF,EAEME,EAAO,CACXD,UAAYD,GAAwCN,EAAQM,IAAgB,GAC5EG,OAASC,GAEAT,EADKS,EAASE,MAAM,GAAG,CAAC,CAACC,IAAI,CAAC,EAAEC,YAAY,GAAK,KAClC,EAE1B,EAEA,SAASC,EAAqBC,EAA4B,CACxD,IAAMC,EAASD,EAAQE,IAAI,CAAC,CAACC,IACvBC,EAAYH,EAAOI,YAAY,GAAG,EACxC,OAAOD,GAAa,EAAIH,EAAOK,MAAM,EAAGF,EAAY,CAAC,EAAIH,CAC3D,CAEA,eAAsBM,EAAwBC,EAAkB/B,EAAgD,CAC9G,GAAI,CAACA,GAAYA,EAASI,WAAW,OAAO,GAAKJ,EAASI,WAAW,OAAO,EAC1E,OAAOJ,EAGT,IAAMC,EAAiBJ,EAA0BK,IAAIF,CAAQ,EAC7D,GAAIC,EACF,OAAOA,EAGT,IAAM+B,EAAUD,EAAMC,QACtB,GAAI,CAACA,GAASC,QAAU,OAAO5B,IAAI6B,iBAAoB,WAC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AASuB,OAAM,GAAIvB,EAASwB,YAAY,CAExF,OAASC,EAAO,CACd,MAAUjB,MAAM,4BAA4BiB,GAAO,CACrD,CAEA,IAAMC,EAAclE,EAAAA,MAAMkE,YAAY,EACtC,GAAIA,EACF,GAAI,CACF,MAAMjE,EAAAA,oBAAoBkE,IAAIC,iBAAiBb,EAAcW,EAAa,CACxEG,OAAQ,CAAC,MAAM,CACjB,CAAC,CACH,OAASJ,EAAO,CACdK,QAAQL,MAAM,+CAA+CA,GAAO,CACtE,CAGF,OAAOV,CACT,C"}
@@ -1 +1 @@
1
- {"version":3,"file":"imagePreview.cjs.js","names":["html","nothing","personInCircleIcon","showHeadingImageFallback","event","image","currentTarget","frame","parentElement","hidden","classList","add","Image","src","alt","nothing","lit_html","personInCircleIcon","showHeadingImageFallback","image","event","frame","Image","src","alt"],"sources":["../../../../../../src/components/profile-heading/editor/sections/heading/imagePreview.ts"],"sourcesContent":["import { html, nothing } from 'lit-html'\nimport '~icons/lucide/circle-user-round'\n\nconst personInCircleIcon = html`<icon-lucide-circle-user-round aria-hidden=\"true\" focusable=\"false\" style=\"width:48px;height:48px;color:#D9E1F2\"></icon-lucide-circle-user-round>`\n\nconst showHeadingImageFallback = (event: Event) => {\n const image = event.currentTarget as HTMLImageElement | null\n const frame = image?.parentElement\n if (!image || !frame) return\n\n image.hidden = true\n frame.classList.add('profile__image-frame--fallback')\n}\n\nexport const Image = (src?: string, alt?: string) => html`\n <div class=${src ? 'profile__image-frame' : 'profile__image-frame profile__image-frame--fallback'}>\n ${src\n ? html`\n <img\n class=\"profile__hero\"\n src=${src}\n alt=${alt || ''}\n width=\"140\"\n height=\"140\"\n loading=\"eager\"\n @error=${showHeadingImageFallback}\n />\n `\n : nothing}\n <div class=\"profile__hero-alt\" role=\"img\" aria-label=${alt || ''}>\n <span class=\"profile__hero-icon\">${personInCircleIcon}</span>\n </div>\n </div>\n`\n"],"mappings":"A,oGAGA,IAAME,EAAqBF,EAAAA,IAAI,oJAEzBG,EAA4BC,GAAiB,CACjD,IAAMC,EAAQD,EAAME,cACdC,EAAQF,GAAOG,cAChBH,GAAUE,IAEfF,EAAMI,OAAS,GACfF,EAAMG,UAAUC,IAAI,gCAAgC,EACtD,EAEaC,GAASC,EAAcC,IAAiBd,EAAAA,IAAI;eAC1Ca,EAAM,uBAAyB,sDAAqD;MAC7FA,EACEb,EAAAA,IAAI;;;kBAGMa,EAAG;kBACHC,GAAO,GAAE;;;;qBAINX,EAAwB;;UAGrCF,EAAAA,QAAO;2DAC4Ca,GAAO,GAAE;yCAC3BZ,EAAkB"}
1
+ {"version":3,"file":"imagePreview.cjs.js","names":["html","nothing","personInCircleIcon","showHeadingImageFallback","event","image","currentTarget","frame","parentElement","hidden","classList","add","Image","src","alt","lit_html","personInCircleIcon","showHeadingImageFallback","image","event","frame","Image","src","alt"],"sources":["../../../../../../src/components/profile-heading/editor/sections/heading/imagePreview.ts"],"sourcesContent":["import { html, nothing } from 'lit-html'\nimport '~icons/lucide/circle-user-round'\n\nconst personInCircleIcon = html`<icon-lucide-circle-user-round aria-hidden=\"true\" focusable=\"false\" style=\"width:48px;height:48px;color:#D9E1F2\"></icon-lucide-circle-user-round>`\n\nconst showHeadingImageFallback = (event: Event) => {\n const image = event.currentTarget as HTMLImageElement | null\n const frame = image?.parentElement\n if (!image || !frame) return\n\n image.hidden = true\n frame.classList.add('profile__image-frame--fallback')\n}\n\nexport const Image = (src?: string, alt?: string) => html`\n <div class=${src ? 'profile__image-frame' : 'profile__image-frame profile__image-frame--fallback'}>\n ${src\n ? html`\n <img\n class=\"profile__hero\"\n src=${src}\n alt=${alt || ''}\n width=\"140\"\n height=\"140\"\n loading=\"eager\"\n @error=${showHeadingImageFallback}\n />\n `\n : nothing}\n <div class=\"profile__hero-alt\" role=\"img\" aria-label=${alt || ''}>\n <span class=\"profile__hero-icon\">${personInCircleIcon}</span>\n </div>\n </div>\n`\n"],"mappings":"A,oGAGA,IAAME,EAAqBF,EAAAA,IAAI,oJAEzBG,EAA4BC,GAAiB,CACjD,IAAMC,EAAQD,EAAME,cACdC,EAAQF,GAAOG,cAChBH,GAAUE,IAEfF,EAAMI,OAAS,GACfF,EAAMG,UAAUC,IAAI,gCAAgC,EACtD,EAEaC,GAASC,EAAcC,IAAiBd,EAAAA,IAAI;eAC1Ca,EAAM,uBAAyB,sDAAqD;MAC7FA,EACEb,EAAAA,IAAI;;;kBAGMa,EAAG;kBACHC,GAAO,GAAE;;;;qBAINX,EAAwB;;UAGrCF,EAAAA,QAAO;2DAC4Ca,GAAO,GAAE;yCAC3BZ,EAAkB"}
@@ -1,2 +1,2 @@
1
- const e=require("../../texts/messageTexts.cjs.js"),t=require("../shared/rdfMutationHelpers.cjs.js"),n=require("../shared/idNodeFactory.cjs.js");let r=require("solid-ui"),i=require("rdflib");function a(e){let t=(e||``).trim();if(!t)return{};let[n,r]=t.split(`/`).map(e=>e.trim());return{subjectPronoun:n||void 0,objectPronoun:r||void 0}}function o(e,t,n,a){let o=a.value.startsWith(`tel:`)?a.value:`tel:${a.value}`,s=(0,i.sym)(o),c=[(0,i.st)(e,r.ns.vcard(`hasTelephone`),n,t),(0,i.st)(n,r.ns.vcard(`value`),s,t)];return a.type&&c.push((0,i.st)(n,r.ns.rdf(`type`),r.ns.vcard(a.type),t)),c}function s(e,t,n,a){let o=a.value.startsWith(`mailto:`)?a.value:`mailto:${a.value}`,s=(0,i.sym)(o),c=[(0,i.st)(e,r.ns.vcard(`hasEmail`),n,t),(0,i.st)(n,r.ns.vcard(`value`),s,t)];return a.type&&c.push((0,i.st)(n,r.ns.rdf(`type`),r.ns.vcard(a.type),t)),c}function c(e,t,n,a){let o=[(0,i.st)(e,r.ns.vcard(`hasAddress`),n,t)];return a.type&&o.push((0,i.st)(n,r.ns.rdf(`type`),r.ns.vcard(a.type),t)),a.streetAddress&&o.push((0,i.st)(n,r.ns.vcard(`street-address`),(0,i.literal)(a.streetAddress),t)),a.locality&&o.push((0,i.st)(n,r.ns.vcard(`locality`),(0,i.literal)(a.locality),t)),a.region&&o.push((0,i.st)(n,r.ns.vcard(`region`),(0,i.literal)(a.region),t)),a.postalCode&&o.push((0,i.st)(n,r.ns.vcard(`postal-code`),(0,i.literal)(a.postalCode),t)),a.countryName&&o.push((0,i.st)(n,r.ns.vcard(`country-name`),(0,i.literal)(a.countryName),t)),o}function l(e,n){return e.find(e=>!!e.entryNode&&!!t.findExistingNode(n,e.entryNode))}function u(e){return e.find(e=>!e.entryNode)}async function d(i,a,s,c){let d=a.doc(),f=i.each(a,r.ns.vcard(`hasTelephone`),null,d),p=[],m=[],h=l(s.remove,f),g=l(s.update,f),_=u(s.create)||s.create[0];if(h?.entryNode){let e=t.findExistingNode(f,h.entryNode);if(e){let n=t.collectLinkedNodeStatements(i,a,r.ns.vcard(`hasTelephone`),d).linkStatements.find(t=>t.object?.value===e.value);n&&p.push(n),p.push(...t.collectNodeStatements(i,e,d))}}if(g){let e=t.findExistingNode(f,g.entryNode);e&&(p.push(...t.collectNodeStatements(i,e,d)),m.push(...o(a,d,e,g)))}_&&m.push(...o(a,d,n.createIdNode(d),_));let v=await t.shouldForceDocumentPutForStatements(i,d,m,void 0,{documentTextCache:c});await t.runUpdateTransport(i,d,p,m,{unsupportedMessage:e.updaterUnsupportedStoreErrorMessageText,failureMessage:`Failed to save heading updates`,documentTextCache:c,useDavFallback:!1,usePutFallback:v,forcePut:v})}async function f(i,a,o,c){let d=a.doc(),f=i.each(a,r.ns.vcard(`hasEmail`),null,d),p=[],m=[],h=l(o.remove,f),g=l(o.update,f),_=u(o.create)||o.create[0];if(h?.entryNode){let e=t.findExistingNode(f,h.entryNode);if(e){let n=t.collectLinkedNodeStatements(i,a,r.ns.vcard(`hasEmail`),d).linkStatements.find(t=>t.object?.value===e.value);n&&p.push(n),p.push(...t.collectNodeStatements(i,e,d))}}if(g){let e=t.findExistingNode(f,g.entryNode);e&&(p.push(...t.collectNodeStatements(i,e,d)),m.push(...s(a,d,e,g)))}_&&m.push(...s(a,d,n.createIdNode(d),_));let v=await t.shouldForceDocumentPutForStatements(i,d,m,void 0,{documentTextCache:c});await t.runUpdateTransport(i,d,p,m,{unsupportedMessage:e.updaterUnsupportedStoreErrorMessageText,failureMessage:`Failed to save heading updates`,documentTextCache:c,useDavFallback:!1,usePutFallback:v,forcePut:v})}async function p(i,a,o,s){let d=a.doc(),f=i.each(a,r.ns.vcard(`hasAddress`),null,d),p=[],m=[],h=l(o.remove,f),g=l(o.update,f),_=u(o.create)||o.create[0];if(h?.entryNode){let e=t.findExistingNode(f,h.entryNode);if(e){let n=t.collectLinkedNodeStatements(i,a,r.ns.vcard(`hasAddress`),d).linkStatements.find(t=>t.object?.value===e.value);n&&p.push(n),p.push(...t.collectNodeStatements(i,e,d))}}if(g){let e=t.findExistingNode(f,g.entryNode);e&&(p.push(...t.collectNodeStatements(i,e,d)),m.push(...c(a,d,e,g)))}_&&m.push(...c(a,d,n.createIdNode(d),_));let v=await t.shouldForceDocumentPutForStatements(i,d,m,void 0,{documentTextCache:s});await t.runUpdateTransport(i,d,p,m,{unsupportedMessage:e.updaterUnsupportedStoreErrorMessageText,failureMessage:`Failed to save heading updates`,documentTextCache:s,useDavFallback:!1,usePutFallback:v,forcePut:v})}async function m(n,o,s,c){let l=o.doc(),u=[],d=[],f=(e,r)=>{let a=(r||``).trim(),s=a?(0,i.literal)(a):null;t.replacePredicateStatements(n,o,e,l,u,d,s)},p=e=>{let a=(e||``).trim(),s=a?a.startsWith(`http://`)||a.startsWith(`https://`)?(0,i.sym)(a):(0,i.literal)(a):null;t.replacePredicateStatements(n,o,r.ns.vcard(`hasPhoto`),l,u,d,s)},m=e=>{let{subjectPronoun:s,objectPronoun:c}=a(e);t.replacePredicateStatements(n,o,r.ns.solid(`preferredSubjectPronoun`),l,u,d,s?(0,i.literal)(s):null),t.replacePredicateStatements(n,o,r.ns.solid(`preferredObjectPronoun`),l,u,d,c?(0,i.literal)(c):null),t.replacePredicateStatements(n,o,r.ns.solid(`preferredRelativePronoun`),l,u,d,null)},h=(e,t=!1)=>{let n=t?{name:``,nickname:``,pronouns:``,dateOfBirth:``,imageSrc:``}:e;f(r.ns.vcard(`fn`),n.name),f(r.ns.foaf(`nick`),n.nickname),f(r.ns.vcard(`nickname`),n.nickname),f(r.ns.vcard(`bday`),n.dateOfBirth),m(n.pronouns),p(n.imageSrc)},g=s.remove[0],_=s.update[0],v=s.create[0],y=_||v||g;y&&h(y,!(!g||_||v));let b=await t.shouldForceDocumentPutForStatements(n,l,d,void 0,{documentTextCache:c});await t.runUpdateTransport(n,l,u,d,{unsupportedMessage:e.updaterUnsupportedStoreErrorMessageText,failureMessage:`Failed to save heading updates`,documentTextCache:c,useDavFallback:!1,usePutFallback:b,forcePut:b})}async function h(t,n,r){try{let e=new Map;await m(t,n,r.basicOps,e),await d(t,n,r.phoneOps,e),await f(t,n,r.emailOps,e),await p(t,n,r.addressOps,e)}catch(t){let n=t instanceof Error?t:Error(String(t));console.error(e.headingMutationSaveFailedDebugText,n);let r=Error(e.saveHeadingUpdatesFailedMessageText);throw Object.defineProperty(r,"cause",{value:n}),r}}exports.processHeadingMutations=h;
1
+ const e=require("../shared/rdfMutationHelpers.cjs.js"),t=require("../shared/idNodeFactory.cjs.js"),n=require("../../texts/messageTexts.cjs.js");let r=require("solid-ui"),i=require("rdflib");function a(e){let t=(e||``).trim();if(!t)return{};let[n,r]=t.split(`/`).map(e=>e.trim());return{subjectPronoun:n||void 0,objectPronoun:r||void 0}}function o(e,t,n,a){let o=a.value.startsWith(`tel:`)?a.value:`tel:${a.value}`,s=(0,i.sym)(o),c=[(0,i.st)(e,r.ns.vcard(`hasTelephone`),n,t),(0,i.st)(n,r.ns.vcard(`value`),s,t)];return a.type&&c.push((0,i.st)(n,r.ns.rdf(`type`),r.ns.vcard(a.type),t)),c}function s(e,t,n,a){let o=a.value.startsWith(`mailto:`)?a.value:`mailto:${a.value}`,s=(0,i.sym)(o),c=[(0,i.st)(e,r.ns.vcard(`hasEmail`),n,t),(0,i.st)(n,r.ns.vcard(`value`),s,t)];return a.type&&c.push((0,i.st)(n,r.ns.rdf(`type`),r.ns.vcard(a.type),t)),c}function c(e,t,n,a){let o=[(0,i.st)(e,r.ns.vcard(`hasAddress`),n,t)];return a.type&&o.push((0,i.st)(n,r.ns.rdf(`type`),r.ns.vcard(a.type),t)),a.streetAddress&&o.push((0,i.st)(n,r.ns.vcard(`street-address`),(0,i.literal)(a.streetAddress),t)),a.locality&&o.push((0,i.st)(n,r.ns.vcard(`locality`),(0,i.literal)(a.locality),t)),a.region&&o.push((0,i.st)(n,r.ns.vcard(`region`),(0,i.literal)(a.region),t)),a.postalCode&&o.push((0,i.st)(n,r.ns.vcard(`postal-code`),(0,i.literal)(a.postalCode),t)),a.countryName&&o.push((0,i.st)(n,r.ns.vcard(`country-name`),(0,i.literal)(a.countryName),t)),o}function l(t,n){return t.find(t=>!!t.entryNode&&!!e.findExistingNode(n,t.entryNode))}function u(e){return e.find(e=>!e.entryNode)}async function d(i,a,s,c){let d=a.doc(),f=i.each(a,r.ns.vcard(`hasTelephone`),null,d),p=[],m=[],h=l(s.remove,f),g=l(s.update,f),_=u(s.create)||s.create[0];if(h?.entryNode){let t=e.findExistingNode(f,h.entryNode);if(t){let n=e.collectLinkedNodeStatements(i,a,r.ns.vcard(`hasTelephone`),d).linkStatements.find(e=>e.object?.value===t.value);n&&p.push(n),p.push(...e.collectNodeStatements(i,t,d))}}if(g){let t=e.findExistingNode(f,g.entryNode);t&&(p.push(...e.collectNodeStatements(i,t,d)),m.push(...o(a,d,t,g)))}_&&m.push(...o(a,d,t.createIdNode(d),_));let v=await e.shouldForceDocumentPutForStatements(i,d,m,void 0,{documentTextCache:c});await e.runUpdateTransport(i,d,p,m,{unsupportedMessage:n.updaterUnsupportedStoreErrorMessageText,failureMessage:`Failed to save heading updates`,documentTextCache:c,useDavFallback:!1,usePutFallback:v,forcePut:v})}async function f(i,a,o,c){let d=a.doc(),f=i.each(a,r.ns.vcard(`hasEmail`),null,d),p=[],m=[],h=l(o.remove,f),g=l(o.update,f),_=u(o.create)||o.create[0];if(h?.entryNode){let t=e.findExistingNode(f,h.entryNode);if(t){let n=e.collectLinkedNodeStatements(i,a,r.ns.vcard(`hasEmail`),d).linkStatements.find(e=>e.object?.value===t.value);n&&p.push(n),p.push(...e.collectNodeStatements(i,t,d))}}if(g){let t=e.findExistingNode(f,g.entryNode);t&&(p.push(...e.collectNodeStatements(i,t,d)),m.push(...s(a,d,t,g)))}_&&m.push(...s(a,d,t.createIdNode(d),_));let v=await e.shouldForceDocumentPutForStatements(i,d,m,void 0,{documentTextCache:c});await e.runUpdateTransport(i,d,p,m,{unsupportedMessage:n.updaterUnsupportedStoreErrorMessageText,failureMessage:`Failed to save heading updates`,documentTextCache:c,useDavFallback:!1,usePutFallback:v,forcePut:v})}async function p(i,a,o,s){let d=a.doc(),f=i.each(a,r.ns.vcard(`hasAddress`),null,d),p=[],m=[],h=l(o.remove,f),g=l(o.update,f),_=u(o.create)||o.create[0];if(h?.entryNode){let t=e.findExistingNode(f,h.entryNode);if(t){let n=e.collectLinkedNodeStatements(i,a,r.ns.vcard(`hasAddress`),d).linkStatements.find(e=>e.object?.value===t.value);n&&p.push(n),p.push(...e.collectNodeStatements(i,t,d))}}if(g){let t=e.findExistingNode(f,g.entryNode);t&&(p.push(...e.collectNodeStatements(i,t,d)),m.push(...c(a,d,t,g)))}_&&m.push(...c(a,d,t.createIdNode(d),_));let v=await e.shouldForceDocumentPutForStatements(i,d,m,void 0,{documentTextCache:s});await e.runUpdateTransport(i,d,p,m,{unsupportedMessage:n.updaterUnsupportedStoreErrorMessageText,failureMessage:`Failed to save heading updates`,documentTextCache:s,useDavFallback:!1,usePutFallback:v,forcePut:v})}async function m(t,o,s,c){let l=o.doc(),u=[],d=[],f=(n,r)=>{let a=(r||``).trim(),s=a?(0,i.literal)(a):null;e.replacePredicateStatements(t,o,n,l,u,d,s)},p=n=>{let a=(n||``).trim(),s=a?a.startsWith(`http://`)||a.startsWith(`https://`)?(0,i.sym)(a):(0,i.literal)(a):null;e.replacePredicateStatements(t,o,r.ns.vcard(`hasPhoto`),l,u,d,s)},m=n=>{let{subjectPronoun:s,objectPronoun:c}=a(n);e.replacePredicateStatements(t,o,r.ns.solid(`preferredSubjectPronoun`),l,u,d,s?(0,i.literal)(s):null),e.replacePredicateStatements(t,o,r.ns.solid(`preferredObjectPronoun`),l,u,d,c?(0,i.literal)(c):null),e.replacePredicateStatements(t,o,r.ns.solid(`preferredRelativePronoun`),l,u,d,null)},h=(e,t=!1)=>{let n=t?{name:``,nickname:``,pronouns:``,dateOfBirth:``,imageSrc:``}:e;f(r.ns.vcard(`fn`),n.name),f(r.ns.foaf(`nick`),n.nickname),f(r.ns.vcard(`nickname`),n.nickname),f(r.ns.vcard(`bday`),n.dateOfBirth),m(n.pronouns),p(n.imageSrc)},g=s.remove[0],_=s.update[0],v=s.create[0],y=_||v||g;y&&h(y,!(!g||_||v));let b=await e.shouldForceDocumentPutForStatements(t,l,d,void 0,{documentTextCache:c});await e.runUpdateTransport(t,l,u,d,{unsupportedMessage:n.updaterUnsupportedStoreErrorMessageText,failureMessage:`Failed to save heading updates`,documentTextCache:c,useDavFallback:!1,usePutFallback:b,forcePut:b})}async function h(e,t,r){try{let n=new Map;await m(e,t,r.basicOps,n),await d(e,t,r.phoneOps,n),await f(e,t,r.emailOps,n),await p(e,t,r.addressOps,n)}catch(e){let t=e instanceof Error?e:Error(String(e));console.error(n.headingMutationSaveFailedDebugText,t);let r=Error(n.saveHeadingUpdatesFailedMessageText);throw Object.defineProperty(r,"cause",{value:t}),r}}exports.processHeadingMutations=h;
2
2
  //# sourceMappingURL=mutations.cjs.js.map
@@ -1 +1 @@
1
- {"version":3,"file":"mutations.cjs.js","names":["st","literal","sym","ns","collectLinkedNodeStatements","collectNodeStatements","findExistingNode","replacePredicateStatements","runUpdateTransport","shouldForceDocumentPutForStatements","createIdNode","headingMutationSaveFailedDebugText","saveHeadingUpdatesFailedMessageText","updaterUnsupportedStoreErrorMessageText","splitPronouns","value","normalized","trim","subjectPronounRaw","objectPronounRaw","split","map","part","subjectPronoun","undefined","objectPronoun","buildPhoneStatements","subject","doc","node","phone","normalizedValue","startsWith","valueNode","inserts","vcard","type","push","rdf","buildEmailStatements","email","buildAddressStatements","address","streetAddress","locality","region","postalCode","countryName","findOpWithExistingEntry","ops","existingNodes","find","op","Boolean","entryNode","findCreateOp","mutatePhoneEntry","store","phoneOps","documentTextCache","existingPhoneNodes","each","deletions","insertions","removePhone","remove","updatePhone","update","createPhone","create","existingNode","linkedPhoneStatements","matchingLinkStatement","linkStatements","statement","object","shouldSerializeDocument","unsupportedMessage","failureMessage","useDavFallback","usePutFallback","forcePut","mutateEmailEntry","emailOps","existingEmailNodes","removeEmail","updateEmail","createEmail","linkedEmailStatements","mutateAddressEntry","addressOps","existingAddressNodes","removeAddress","updateAddress","createAddress","linkedAddressStatements","mutateBasicProfileEntry","basicOps","replaceLiteralField","predicate","nextObject","replacePhotoField","replacePronounFields","solid","applyBasics","basic","clearAll","data","name","nickname","pronouns","dateOfBirth","imageSrc","foaf","removeBasic","updateBasic","createBasic","selectedBasic","processHeadingMutations","mutationPlan","Map","error","rootError","Error","String","console","saveError","Object","defineProperty","sym","st","ns","literal","findExistingNode","collectLinkedNodeStatements","collectNodeStatements","createIdNode","shouldForceDocumentPutForStatements","runUpdateTransport","updaterUnsupportedStoreErrorMessageText","headingMutationSaveFailedDebugText","saveHeadingUpdatesFailedMessageText","require_messageTexts","require_rdfMutationHelpers","require_idNodeFactory","solid_ui","rdflib","splitPronouns","normalized","value","subjectPronounRaw","objectPronounRaw","part","buildPhoneStatements","normalizedValue","phone","valueNode","inserts","subject","node","doc","buildEmailStatements","email","buildAddressStatements","address","findOpWithExistingEntry","ops","op","existingNodes","findCreateOp","mutatePhoneEntry","existingPhoneNodes","store","deletions","insertions","removePhone","phoneOps","updatePhone","createPhone","existingNode","matchingLinkStatement","statement","shouldSerializeDocument","mutateEmailEntry","existingEmailNodes","removeEmail","emailOps","updateEmail","createEmail","mutateAddressEntry","existingAddressNodes","removeAddress","addressOps","updateAddress","createAddress","mutateBasicProfileEntry","replaceLiteralField","nextObject","predicate","replacePhotoField","replacePronounFields","subjectPronoun","objectPronoun","applyBasics","data","clearAll","basic","removeBasic","basicOps","updateBasic","createBasic","selectedBasic","processHeadingMutations","documentTextCache","mutationPlan","error","rootError","saveError"],"sources":["../../../../../../src/components/profile-heading/editor/sections/heading/mutations.ts"],"sourcesContent":["import { LiveStore, NamedNode, Node, st, literal, sym } from 'rdflib'\nimport { ns } from 'solid-ui'\nimport { ProfileBasicRow, HeadingMutationPlan } from './types'\nimport { MutationOps } from '../shared/types'\nimport { MutationDocumentTextCache, collectLinkedNodeStatements, collectNodeStatements, findExistingNode, replacePredicateStatements, runUpdateTransport, shouldForceDocumentPutForStatements } from '../shared/rdfMutationHelpers'\nimport { createIdNode } from '../shared/idNodeFactory'\nimport { ContactAddressRow, ContactPointRow } from '../contactInfo/types'\nimport { headingMutationSaveFailedDebugText, saveHeadingUpdatesFailedMessageText, updaterUnsupportedStoreErrorMessageText } from '../../texts'\n\nfunction splitPronouns (value?: string): { subjectPronoun?: string, objectPronoun?: string } {\n const normalized = (value || '').trim()\n if (!normalized) return {}\n\n const [subjectPronounRaw, objectPronounRaw] = normalized.split('/').map((part) => part.trim())\n const subjectPronoun = subjectPronounRaw || undefined\n const objectPronoun = objectPronounRaw || undefined\n\n return { subjectPronoun, objectPronoun }\n}\n\nfunction buildPhoneStatements (subject: NamedNode, doc: NamedNode, node: Node, phone: ContactPointRow) {\n const normalizedValue = phone.value.startsWith('tel:') ? phone.value : `tel:${phone.value}`\n const valueNode = sym(normalizedValue)\n const inserts = [\n st(subject, ns.vcard('hasTelephone'), node as any, doc),\n st(node as any, ns.vcard('value'), valueNode as any, doc)\n ]\n\n if (phone.type) {\n inserts.push(st(node as any, ns.rdf('type'), ns.vcard(phone.type), doc))\n }\n\n return inserts\n}\n\nfunction buildEmailStatements (subject: NamedNode, doc: NamedNode, node: Node, email: ContactPointRow) {\n const normalizedValue = email.value.startsWith('mailto:') ? email.value : `mailto:${email.value}`\n const valueNode = sym(normalizedValue)\n const inserts = [\n st(subject, ns.vcard('hasEmail'), node as any, doc),\n st(node as any, ns.vcard('value'), valueNode as any, doc)\n ]\n\n if (email.type) {\n inserts.push(st(node as any, ns.rdf('type'), ns.vcard(email.type), doc))\n }\n\n return inserts\n}\n\nfunction buildAddressStatements (subject: NamedNode, doc: NamedNode, node: Node, address: ContactAddressRow) {\n const inserts = [st(subject, ns.vcard('hasAddress'), node as any, doc)]\n\n if (address.type) inserts.push(st(node as any, ns.rdf('type'), ns.vcard(address.type), doc))\n if (address.streetAddress) inserts.push(st(node as any, ns.vcard('street-address'), literal(address.streetAddress), doc))\n if (address.locality) inserts.push(st(node as any, ns.vcard('locality'), literal(address.locality), doc))\n if (address.region) inserts.push(st(node as any, ns.vcard('region'), literal(address.region), doc))\n if (address.postalCode) inserts.push(st(node as any, ns.vcard('postal-code'), literal(address.postalCode), doc))\n if (address.countryName) inserts.push(st(node as any, ns.vcard('country-name'), literal(address.countryName), doc))\n\n return inserts\n}\n\nfunction findOpWithExistingEntry<T extends { entryNode: string }> (ops: T[], existingNodes: Node[]): T | undefined {\n return ops.find((op) => Boolean(op.entryNode) && Boolean(findExistingNode(existingNodes, op.entryNode)))\n}\n\nfunction findCreateOp<T extends { entryNode: string }> (ops: T[]): T | undefined {\n return ops.find((op) => !op.entryNode)\n}\n\nasync function mutatePhoneEntry (store: LiveStore, subject: NamedNode, phoneOps: MutationOps<ContactPointRow>, documentTextCache?: MutationDocumentTextCache) {\n const doc = subject.doc()\n const existingPhoneNodes = store.each(subject, ns.vcard('hasTelephone'), null, doc) as Node[]\n const deletions: any[] = []\n const insertions: any[] = []\n\n const removePhone = findOpWithExistingEntry(phoneOps.remove, existingPhoneNodes)\n const updatePhone = findOpWithExistingEntry(phoneOps.update, existingPhoneNodes)\n const createPhone = findCreateOp(phoneOps.create) || phoneOps.create[0]\n\n if (removePhone?.entryNode) {\n const existingNode = findExistingNode(existingPhoneNodes, removePhone.entryNode)\n if (existingNode) {\n const linkedPhoneStatements = collectLinkedNodeStatements(store, subject, ns.vcard('hasTelephone'), doc)\n const matchingLinkStatement = linkedPhoneStatements.linkStatements.find((statement) => statement.object?.value === existingNode.value)\n if (matchingLinkStatement) {\n deletions.push(matchingLinkStatement)\n }\n deletions.push(...collectNodeStatements(store, existingNode, doc))\n }\n }\n\n if (updatePhone) {\n const existingNode = findExistingNode(existingPhoneNodes, updatePhone.entryNode)\n if (existingNode) {\n deletions.push(...collectNodeStatements(store, existingNode, doc))\n insertions.push(...buildPhoneStatements(subject, doc, existingNode, updatePhone))\n }\n }\n\n if (createPhone) {\n insertions.push(...buildPhoneStatements(subject, doc, createIdNode(doc), createPhone))\n }\n\n const shouldSerializeDocument = await shouldForceDocumentPutForStatements(store, doc, insertions, undefined, { documentTextCache })\n\n await runUpdateTransport(store, doc, deletions, insertions, {\n unsupportedMessage: updaterUnsupportedStoreErrorMessageText,\n failureMessage: 'Failed to save heading updates',\n documentTextCache,\n useDavFallback: false,\n usePutFallback: shouldSerializeDocument,\n forcePut: shouldSerializeDocument\n })\n}\n\nasync function mutateEmailEntry (store: LiveStore, subject: NamedNode, emailOps: MutationOps<ContactPointRow>, documentTextCache?: MutationDocumentTextCache) {\n const doc = subject.doc()\n const existingEmailNodes = store.each(subject, ns.vcard('hasEmail'), null, doc) as Node[]\n const deletions: any[] = []\n const insertions: any[] = []\n\n const removeEmail = findOpWithExistingEntry(emailOps.remove, existingEmailNodes)\n const updateEmail = findOpWithExistingEntry(emailOps.update, existingEmailNodes)\n const createEmail = findCreateOp(emailOps.create) || emailOps.create[0]\n\n if (removeEmail?.entryNode) {\n const existingNode = findExistingNode(existingEmailNodes, removeEmail.entryNode)\n if (existingNode) {\n const linkedEmailStatements = collectLinkedNodeStatements(store, subject, ns.vcard('hasEmail'), doc)\n const matchingLinkStatement = linkedEmailStatements.linkStatements.find((statement) => statement.object?.value === existingNode.value)\n if (matchingLinkStatement) {\n deletions.push(matchingLinkStatement)\n }\n deletions.push(...collectNodeStatements(store, existingNode, doc))\n }\n }\n\n if (updateEmail) {\n const existingNode = findExistingNode(existingEmailNodes, updateEmail.entryNode)\n if (existingNode) {\n deletions.push(...collectNodeStatements(store, existingNode, doc))\n insertions.push(...buildEmailStatements(subject, doc, existingNode, updateEmail))\n }\n }\n\n if (createEmail) {\n insertions.push(...buildEmailStatements(subject, doc, createIdNode(doc), createEmail))\n }\n\n const shouldSerializeDocument = await shouldForceDocumentPutForStatements(store, doc, insertions, undefined, { documentTextCache })\n\n await runUpdateTransport(store, doc, deletions, insertions, {\n unsupportedMessage: updaterUnsupportedStoreErrorMessageText,\n failureMessage: 'Failed to save heading updates',\n documentTextCache,\n useDavFallback: false,\n usePutFallback: shouldSerializeDocument,\n forcePut: shouldSerializeDocument\n })\n}\n\nasync function mutateAddressEntry (store: LiveStore, subject: NamedNode, addressOps: MutationOps<ContactAddressRow>, documentTextCache?: MutationDocumentTextCache) {\n const doc = subject.doc()\n const existingAddressNodes = store.each(subject, ns.vcard('hasAddress'), null, doc) as Node[]\n const deletions: any[] = []\n const insertions: any[] = []\n\n const removeAddress = findOpWithExistingEntry(addressOps.remove, existingAddressNodes)\n const updateAddress = findOpWithExistingEntry(addressOps.update, existingAddressNodes)\n const createAddress = findCreateOp(addressOps.create) || addressOps.create[0]\n\n if (removeAddress?.entryNode) {\n const existingNode = findExistingNode(existingAddressNodes, removeAddress.entryNode)\n if (existingNode) {\n const linkedAddressStatements = collectLinkedNodeStatements(store, subject, ns.vcard('hasAddress'), doc)\n const matchingLinkStatement = linkedAddressStatements.linkStatements.find((statement) => statement.object?.value === existingNode.value)\n if (matchingLinkStatement) {\n deletions.push(matchingLinkStatement)\n }\n deletions.push(...collectNodeStatements(store, existingNode, doc))\n }\n }\n\n if (updateAddress) {\n const existingNode = findExistingNode(existingAddressNodes, updateAddress.entryNode)\n if (existingNode) {\n deletions.push(...collectNodeStatements(store, existingNode, doc))\n insertions.push(...buildAddressStatements(subject, doc, existingNode, updateAddress))\n }\n }\n\n if (createAddress) {\n insertions.push(...buildAddressStatements(subject, doc, createIdNode(doc), createAddress))\n }\n\n const shouldSerializeDocument = await shouldForceDocumentPutForStatements(store, doc, insertions, undefined, { documentTextCache })\n\n await runUpdateTransport(store, doc, deletions, insertions, {\n unsupportedMessage: updaterUnsupportedStoreErrorMessageText,\n failureMessage: 'Failed to save heading updates',\n documentTextCache,\n useDavFallback: false,\n usePutFallback: shouldSerializeDocument,\n forcePut: shouldSerializeDocument\n })\n}\n\nasync function mutateBasicProfileEntry (store: LiveStore, subject: NamedNode, basicOps: MutationOps<ProfileBasicRow>, documentTextCache?: MutationDocumentTextCache) {\n const doc = subject.doc()\n const deletions: any[] = []\n const insertions: any[] = []\n\n const replaceLiteralField = (predicate: NamedNode, value?: string) => {\n const normalized = (value || '').trim()\n const nextObject = normalized ? literal(normalized) : null\n replacePredicateStatements(store, subject, predicate, doc, deletions, insertions, nextObject)\n }\n\n const replacePhotoField = (value?: string) => {\n const normalized = (value || '').trim()\n const nextObject = !normalized\n ? null\n : (normalized.startsWith('http://') || normalized.startsWith('https://'))\n ? sym(normalized)\n : literal(normalized)\n replacePredicateStatements(store, subject, ns.vcard('hasPhoto'), doc, deletions, insertions, nextObject)\n }\n\n const replacePronounFields = (value?: string) => {\n const { subjectPronoun, objectPronoun } = splitPronouns(value)\n\n replacePredicateStatements(\n store,\n subject,\n ns.solid('preferredSubjectPronoun'),\n doc,\n deletions,\n insertions,\n subjectPronoun ? literal(subjectPronoun) : null\n )\n replacePredicateStatements(\n store,\n subject,\n ns.solid('preferredObjectPronoun'),\n doc,\n deletions,\n insertions,\n objectPronoun ? literal(objectPronoun) : null\n )\n replacePredicateStatements(\n store,\n subject,\n ns.solid('preferredRelativePronoun'),\n doc,\n deletions,\n insertions,\n null\n )\n }\n\n const applyBasics = (basic: ProfileBasicRow, clearAll = false) => {\n const data = clearAll\n ? {\n name: '',\n nickname: '',\n pronouns: '',\n dateOfBirth: '',\n imageSrc: ''\n }\n : basic\n\n replaceLiteralField(ns.vcard('fn'), data.name)\n // Keep foaf:nick in sync where available in existing data.\n replaceLiteralField(ns.foaf('nick'), data.nickname)\n replaceLiteralField(ns.vcard('nickname'), data.nickname)\n replaceLiteralField(ns.vcard('bday'), data.dateOfBirth)\n replacePronounFields(data.pronouns)\n replacePhotoField(data.imageSrc)\n }\n\n const removeBasic = basicOps.remove[0]\n const updateBasic = basicOps.update[0]\n const createBasic = basicOps.create[0]\n\n const selectedBasic = updateBasic || createBasic || removeBasic\n if (selectedBasic) {\n applyBasics(selectedBasic, Boolean(removeBasic && !updateBasic && !createBasic))\n }\n\n const shouldSerializeDocument = await shouldForceDocumentPutForStatements(store, doc, insertions, undefined, { documentTextCache })\n\n await runUpdateTransport(store, doc, deletions, insertions, {\n unsupportedMessage: updaterUnsupportedStoreErrorMessageText,\n failureMessage: 'Failed to save heading updates',\n documentTextCache,\n useDavFallback: false,\n usePutFallback: shouldSerializeDocument,\n forcePut: shouldSerializeDocument\n })\n}\n\nexport async function processHeadingMutations (store: LiveStore, subject: NamedNode, mutationPlan: HeadingMutationPlan) {\n try {\n const documentTextCache: MutationDocumentTextCache = new Map()\n await mutateBasicProfileEntry(store, subject, mutationPlan.basicOps, documentTextCache)\n await mutatePhoneEntry(store, subject, mutationPlan.phoneOps, documentTextCache)\n await mutateEmailEntry(store, subject, mutationPlan.emailOps, documentTextCache)\n await mutateAddressEntry(store, subject, mutationPlan.addressOps, documentTextCache)\n } catch (error) {\n const rootError = error instanceof Error ? error : new Error(String(error))\n console.error(headingMutationSaveFailedDebugText, rootError)\n const saveError = new Error(saveHeadingUpdatesFailedMessageText)\n Object.defineProperty(saveError, 'cause', { value: rootError })\n throw saveError\n }\n}\n"],"mappings":"A,8LASA,SAASc,EAAeC,EAAqE,CAC3F,IAAMC,GAAcD,GAAS,GAAA,CAAIE,KAAK,EACtC,GAAI,CAACD,EAAY,MAAO,CAAC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/G,MAAO2G,CAAU,CAAC,EACxDI,CACR,CACF,C"}
1
+ {"version":3,"file":"mutations.cjs.js","names":["st","literal","sym","ns","collectLinkedNodeStatements","collectNodeStatements","findExistingNode","replacePredicateStatements","runUpdateTransport","shouldForceDocumentPutForStatements","createIdNode","headingMutationSaveFailedDebugText","saveHeadingUpdatesFailedMessageText","updaterUnsupportedStoreErrorMessageText","splitPronouns","value","normalized","trim","subjectPronounRaw","objectPronounRaw","split","map","part","subjectPronoun","undefined","objectPronoun","buildPhoneStatements","subject","doc","node","phone","normalizedValue","startsWith","valueNode","inserts","vcard","type","push","rdf","buildEmailStatements","email","buildAddressStatements","address","streetAddress","locality","region","postalCode","countryName","findOpWithExistingEntry","ops","existingNodes","find","op","Boolean","entryNode","findCreateOp","mutatePhoneEntry","store","phoneOps","documentTextCache","existingPhoneNodes","each","deletions","insertions","removePhone","remove","updatePhone","update","createPhone","create","existingNode","linkedPhoneStatements","matchingLinkStatement","linkStatements","statement","object","shouldSerializeDocument","unsupportedMessage","failureMessage","useDavFallback","usePutFallback","forcePut","mutateEmailEntry","emailOps","existingEmailNodes","removeEmail","updateEmail","createEmail","linkedEmailStatements","mutateAddressEntry","addressOps","existingAddressNodes","removeAddress","updateAddress","createAddress","linkedAddressStatements","mutateBasicProfileEntry","basicOps","replaceLiteralField","predicate","nextObject","replacePhotoField","replacePronounFields","solid","applyBasics","basic","clearAll","data","name","nickname","pronouns","dateOfBirth","imageSrc","foaf","removeBasic","updateBasic","createBasic","selectedBasic","processHeadingMutations","mutationPlan","Map","error","rootError","Error","String","console","saveError","Object","defineProperty","require_rdfMutationHelpers","require_idNodeFactory","require_messageTexts","solid_ui","rdflib","splitPronouns","normalized","value","subjectPronounRaw","objectPronounRaw","part","buildPhoneStatements","normalizedValue","phone","valueNode","inserts","subject","node","doc","buildEmailStatements","email","buildAddressStatements","address","findOpWithExistingEntry","ops","op","existingNodes","findCreateOp","mutatePhoneEntry","existingPhoneNodes","store","deletions","insertions","removePhone","phoneOps","updatePhone","createPhone","existingNode","matchingLinkStatement","statement","shouldSerializeDocument","mutateEmailEntry","existingEmailNodes","removeEmail","emailOps","updateEmail","createEmail","mutateAddressEntry","existingAddressNodes","removeAddress","addressOps","updateAddress","createAddress","mutateBasicProfileEntry","replaceLiteralField","nextObject","predicate","replacePhotoField","replacePronounFields","subjectPronoun","objectPronoun","applyBasics","data","clearAll","basic","removeBasic","basicOps","updateBasic","createBasic","selectedBasic","processHeadingMutations","documentTextCache","mutationPlan","error","rootError","saveError"],"sources":["../../../../../../src/components/profile-heading/editor/sections/heading/mutations.ts"],"sourcesContent":["import { LiveStore, NamedNode, Node, st, literal, sym } from 'rdflib'\nimport { ns } from 'solid-ui'\nimport { ProfileBasicRow, HeadingMutationPlan } from './types'\nimport { MutationOps } from '../shared/types'\nimport { MutationDocumentTextCache, collectLinkedNodeStatements, collectNodeStatements, findExistingNode, replacePredicateStatements, runUpdateTransport, shouldForceDocumentPutForStatements } from '../shared/rdfMutationHelpers'\nimport { createIdNode } from '../shared/idNodeFactory'\nimport { ContactAddressRow, ContactPointRow } from '../contactInfo/types'\nimport { headingMutationSaveFailedDebugText, saveHeadingUpdatesFailedMessageText, updaterUnsupportedStoreErrorMessageText } from '../../texts'\n\nfunction splitPronouns (value?: string): { subjectPronoun?: string, objectPronoun?: string } {\n const normalized = (value || '').trim()\n if (!normalized) return {}\n\n const [subjectPronounRaw, objectPronounRaw] = normalized.split('/').map((part) => part.trim())\n const subjectPronoun = subjectPronounRaw || undefined\n const objectPronoun = objectPronounRaw || undefined\n\n return { subjectPronoun, objectPronoun }\n}\n\nfunction buildPhoneStatements (subject: NamedNode, doc: NamedNode, node: Node, phone: ContactPointRow) {\n const normalizedValue = phone.value.startsWith('tel:') ? phone.value : `tel:${phone.value}`\n const valueNode = sym(normalizedValue)\n const inserts = [\n st(subject, ns.vcard('hasTelephone'), node as any, doc),\n st(node as any, ns.vcard('value'), valueNode as any, doc)\n ]\n\n if (phone.type) {\n inserts.push(st(node as any, ns.rdf('type'), ns.vcard(phone.type), doc))\n }\n\n return inserts\n}\n\nfunction buildEmailStatements (subject: NamedNode, doc: NamedNode, node: Node, email: ContactPointRow) {\n const normalizedValue = email.value.startsWith('mailto:') ? email.value : `mailto:${email.value}`\n const valueNode = sym(normalizedValue)\n const inserts = [\n st(subject, ns.vcard('hasEmail'), node as any, doc),\n st(node as any, ns.vcard('value'), valueNode as any, doc)\n ]\n\n if (email.type) {\n inserts.push(st(node as any, ns.rdf('type'), ns.vcard(email.type), doc))\n }\n\n return inserts\n}\n\nfunction buildAddressStatements (subject: NamedNode, doc: NamedNode, node: Node, address: ContactAddressRow) {\n const inserts = [st(subject, ns.vcard('hasAddress'), node as any, doc)]\n\n if (address.type) inserts.push(st(node as any, ns.rdf('type'), ns.vcard(address.type), doc))\n if (address.streetAddress) inserts.push(st(node as any, ns.vcard('street-address'), literal(address.streetAddress), doc))\n if (address.locality) inserts.push(st(node as any, ns.vcard('locality'), literal(address.locality), doc))\n if (address.region) inserts.push(st(node as any, ns.vcard('region'), literal(address.region), doc))\n if (address.postalCode) inserts.push(st(node as any, ns.vcard('postal-code'), literal(address.postalCode), doc))\n if (address.countryName) inserts.push(st(node as any, ns.vcard('country-name'), literal(address.countryName), doc))\n\n return inserts\n}\n\nfunction findOpWithExistingEntry<T extends { entryNode: string }> (ops: T[], existingNodes: Node[]): T | undefined {\n return ops.find((op) => Boolean(op.entryNode) && Boolean(findExistingNode(existingNodes, op.entryNode)))\n}\n\nfunction findCreateOp<T extends { entryNode: string }> (ops: T[]): T | undefined {\n return ops.find((op) => !op.entryNode)\n}\n\nasync function mutatePhoneEntry (store: LiveStore, subject: NamedNode, phoneOps: MutationOps<ContactPointRow>, documentTextCache?: MutationDocumentTextCache) {\n const doc = subject.doc()\n const existingPhoneNodes = store.each(subject, ns.vcard('hasTelephone'), null, doc) as Node[]\n const deletions: any[] = []\n const insertions: any[] = []\n\n const removePhone = findOpWithExistingEntry(phoneOps.remove, existingPhoneNodes)\n const updatePhone = findOpWithExistingEntry(phoneOps.update, existingPhoneNodes)\n const createPhone = findCreateOp(phoneOps.create) || phoneOps.create[0]\n\n if (removePhone?.entryNode) {\n const existingNode = findExistingNode(existingPhoneNodes, removePhone.entryNode)\n if (existingNode) {\n const linkedPhoneStatements = collectLinkedNodeStatements(store, subject, ns.vcard('hasTelephone'), doc)\n const matchingLinkStatement = linkedPhoneStatements.linkStatements.find((statement) => statement.object?.value === existingNode.value)\n if (matchingLinkStatement) {\n deletions.push(matchingLinkStatement)\n }\n deletions.push(...collectNodeStatements(store, existingNode, doc))\n }\n }\n\n if (updatePhone) {\n const existingNode = findExistingNode(existingPhoneNodes, updatePhone.entryNode)\n if (existingNode) {\n deletions.push(...collectNodeStatements(store, existingNode, doc))\n insertions.push(...buildPhoneStatements(subject, doc, existingNode, updatePhone))\n }\n }\n\n if (createPhone) {\n insertions.push(...buildPhoneStatements(subject, doc, createIdNode(doc), createPhone))\n }\n\n const shouldSerializeDocument = await shouldForceDocumentPutForStatements(store, doc, insertions, undefined, { documentTextCache })\n\n await runUpdateTransport(store, doc, deletions, insertions, {\n unsupportedMessage: updaterUnsupportedStoreErrorMessageText,\n failureMessage: 'Failed to save heading updates',\n documentTextCache,\n useDavFallback: false,\n usePutFallback: shouldSerializeDocument,\n forcePut: shouldSerializeDocument\n })\n}\n\nasync function mutateEmailEntry (store: LiveStore, subject: NamedNode, emailOps: MutationOps<ContactPointRow>, documentTextCache?: MutationDocumentTextCache) {\n const doc = subject.doc()\n const existingEmailNodes = store.each(subject, ns.vcard('hasEmail'), null, doc) as Node[]\n const deletions: any[] = []\n const insertions: any[] = []\n\n const removeEmail = findOpWithExistingEntry(emailOps.remove, existingEmailNodes)\n const updateEmail = findOpWithExistingEntry(emailOps.update, existingEmailNodes)\n const createEmail = findCreateOp(emailOps.create) || emailOps.create[0]\n\n if (removeEmail?.entryNode) {\n const existingNode = findExistingNode(existingEmailNodes, removeEmail.entryNode)\n if (existingNode) {\n const linkedEmailStatements = collectLinkedNodeStatements(store, subject, ns.vcard('hasEmail'), doc)\n const matchingLinkStatement = linkedEmailStatements.linkStatements.find((statement) => statement.object?.value === existingNode.value)\n if (matchingLinkStatement) {\n deletions.push(matchingLinkStatement)\n }\n deletions.push(...collectNodeStatements(store, existingNode, doc))\n }\n }\n\n if (updateEmail) {\n const existingNode = findExistingNode(existingEmailNodes, updateEmail.entryNode)\n if (existingNode) {\n deletions.push(...collectNodeStatements(store, existingNode, doc))\n insertions.push(...buildEmailStatements(subject, doc, existingNode, updateEmail))\n }\n }\n\n if (createEmail) {\n insertions.push(...buildEmailStatements(subject, doc, createIdNode(doc), createEmail))\n }\n\n const shouldSerializeDocument = await shouldForceDocumentPutForStatements(store, doc, insertions, undefined, { documentTextCache })\n\n await runUpdateTransport(store, doc, deletions, insertions, {\n unsupportedMessage: updaterUnsupportedStoreErrorMessageText,\n failureMessage: 'Failed to save heading updates',\n documentTextCache,\n useDavFallback: false,\n usePutFallback: shouldSerializeDocument,\n forcePut: shouldSerializeDocument\n })\n}\n\nasync function mutateAddressEntry (store: LiveStore, subject: NamedNode, addressOps: MutationOps<ContactAddressRow>, documentTextCache?: MutationDocumentTextCache) {\n const doc = subject.doc()\n const existingAddressNodes = store.each(subject, ns.vcard('hasAddress'), null, doc) as Node[]\n const deletions: any[] = []\n const insertions: any[] = []\n\n const removeAddress = findOpWithExistingEntry(addressOps.remove, existingAddressNodes)\n const updateAddress = findOpWithExistingEntry(addressOps.update, existingAddressNodes)\n const createAddress = findCreateOp(addressOps.create) || addressOps.create[0]\n\n if (removeAddress?.entryNode) {\n const existingNode = findExistingNode(existingAddressNodes, removeAddress.entryNode)\n if (existingNode) {\n const linkedAddressStatements = collectLinkedNodeStatements(store, subject, ns.vcard('hasAddress'), doc)\n const matchingLinkStatement = linkedAddressStatements.linkStatements.find((statement) => statement.object?.value === existingNode.value)\n if (matchingLinkStatement) {\n deletions.push(matchingLinkStatement)\n }\n deletions.push(...collectNodeStatements(store, existingNode, doc))\n }\n }\n\n if (updateAddress) {\n const existingNode = findExistingNode(existingAddressNodes, updateAddress.entryNode)\n if (existingNode) {\n deletions.push(...collectNodeStatements(store, existingNode, doc))\n insertions.push(...buildAddressStatements(subject, doc, existingNode, updateAddress))\n }\n }\n\n if (createAddress) {\n insertions.push(...buildAddressStatements(subject, doc, createIdNode(doc), createAddress))\n }\n\n const shouldSerializeDocument = await shouldForceDocumentPutForStatements(store, doc, insertions, undefined, { documentTextCache })\n\n await runUpdateTransport(store, doc, deletions, insertions, {\n unsupportedMessage: updaterUnsupportedStoreErrorMessageText,\n failureMessage: 'Failed to save heading updates',\n documentTextCache,\n useDavFallback: false,\n usePutFallback: shouldSerializeDocument,\n forcePut: shouldSerializeDocument\n })\n}\n\nasync function mutateBasicProfileEntry (store: LiveStore, subject: NamedNode, basicOps: MutationOps<ProfileBasicRow>, documentTextCache?: MutationDocumentTextCache) {\n const doc = subject.doc()\n const deletions: any[] = []\n const insertions: any[] = []\n\n const replaceLiteralField = (predicate: NamedNode, value?: string) => {\n const normalized = (value || '').trim()\n const nextObject = normalized ? literal(normalized) : null\n replacePredicateStatements(store, subject, predicate, doc, deletions, insertions, nextObject)\n }\n\n const replacePhotoField = (value?: string) => {\n const normalized = (value || '').trim()\n const nextObject = !normalized\n ? null\n : (normalized.startsWith('http://') || normalized.startsWith('https://'))\n ? sym(normalized)\n : literal(normalized)\n replacePredicateStatements(store, subject, ns.vcard('hasPhoto'), doc, deletions, insertions, nextObject)\n }\n\n const replacePronounFields = (value?: string) => {\n const { subjectPronoun, objectPronoun } = splitPronouns(value)\n\n replacePredicateStatements(\n store,\n subject,\n ns.solid('preferredSubjectPronoun'),\n doc,\n deletions,\n insertions,\n subjectPronoun ? literal(subjectPronoun) : null\n )\n replacePredicateStatements(\n store,\n subject,\n ns.solid('preferredObjectPronoun'),\n doc,\n deletions,\n insertions,\n objectPronoun ? literal(objectPronoun) : null\n )\n replacePredicateStatements(\n store,\n subject,\n ns.solid('preferredRelativePronoun'),\n doc,\n deletions,\n insertions,\n null\n )\n }\n\n const applyBasics = (basic: ProfileBasicRow, clearAll = false) => {\n const data = clearAll\n ? {\n name: '',\n nickname: '',\n pronouns: '',\n dateOfBirth: '',\n imageSrc: ''\n }\n : basic\n\n replaceLiteralField(ns.vcard('fn'), data.name)\n // Keep foaf:nick in sync where available in existing data.\n replaceLiteralField(ns.foaf('nick'), data.nickname)\n replaceLiteralField(ns.vcard('nickname'), data.nickname)\n replaceLiteralField(ns.vcard('bday'), data.dateOfBirth)\n replacePronounFields(data.pronouns)\n replacePhotoField(data.imageSrc)\n }\n\n const removeBasic = basicOps.remove[0]\n const updateBasic = basicOps.update[0]\n const createBasic = basicOps.create[0]\n\n const selectedBasic = updateBasic || createBasic || removeBasic\n if (selectedBasic) {\n applyBasics(selectedBasic, Boolean(removeBasic && !updateBasic && !createBasic))\n }\n\n const shouldSerializeDocument = await shouldForceDocumentPutForStatements(store, doc, insertions, undefined, { documentTextCache })\n\n await runUpdateTransport(store, doc, deletions, insertions, {\n unsupportedMessage: updaterUnsupportedStoreErrorMessageText,\n failureMessage: 'Failed to save heading updates',\n documentTextCache,\n useDavFallback: false,\n usePutFallback: shouldSerializeDocument,\n forcePut: shouldSerializeDocument\n })\n}\n\nexport async function processHeadingMutations (store: LiveStore, subject: NamedNode, mutationPlan: HeadingMutationPlan) {\n try {\n const documentTextCache: MutationDocumentTextCache = new Map()\n await mutateBasicProfileEntry(store, subject, mutationPlan.basicOps, documentTextCache)\n await mutatePhoneEntry(store, subject, mutationPlan.phoneOps, documentTextCache)\n await mutateEmailEntry(store, subject, mutationPlan.emailOps, documentTextCache)\n await mutateAddressEntry(store, subject, mutationPlan.addressOps, documentTextCache)\n } catch (error) {\n const rootError = error instanceof Error ? error : new Error(String(error))\n console.error(headingMutationSaveFailedDebugText, rootError)\n const saveError = new Error(saveHeadingUpdatesFailedMessageText)\n Object.defineProperty(saveError, 'cause', { value: rootError })\n throw saveError\n }\n}\n"],"mappings":"A,8LASA,SAASc,E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