{"version":3,"sources":["webpack:///./app/javascript/src/lib/dropdown.ts","webpack:///./app/javascript/src/lib/photo_upload/photoUpload.ts","webpack:///./app/javascript/src/lazy.ts"],"names":["initDropdowns","document","querySelectorAll","forEach","i","template","querySelector","dataset","dropdown","style","display","tippy","appendTo","body","animation","content","arrow","trigger","interactive","theme","initPhotoUploadModal","fcMetadata","logged_in","delegate","e","$target","target","options","Promise","resolve","$modal","$body","PhotoUpload","Object","assign","url","Routes","signedPhotoUrl","callback","show","$source","classList","add","transition","remove","openPhotoUploadModal","attachTo","reload","type","$i","combineWith","name","$model","mountVueComponent","AppPhotoUploadPreviews","location","usersCreateAccount","initRecModal"],"mappings":"2FAAA,8CAEO,SAASA,IACdC,SAASC,iBAAiB,mBAAmBC,SAAQ,SAACC,GACpD,IAAMC,EAAWJ,SAASK,cAAcF,EAAEG,QAAQC,UAClDH,EAASI,MAAMC,QAAU,QAEzBC,YAAMP,EAAG,CACPQ,SAAU,kBAAMX,SAASY,MACzBC,UAAW,aACXC,QAASV,EACTW,OAAO,EACPC,QAAS,QACTC,aAAa,EACbC,MAAO,sB,0HCSN,SAASC,IAETC,IAAWC,WAIhBC,IAAS,gBAAiB,SAAS,SAACC,GAClC,IAAMC,EAAUD,EAAEE,OADkC,EAEjBD,EAAQlB,SAuBxC,WAA4E,IAA9CoB,EAA6C,uDAA1B,GAC/C,IAAIC,SAAQ,SAAAC,GACjB,IAAMC,EAAS7B,SAASK,cAAc,uBAChCyB,EAAQD,EAAOxB,cAAc,eACrB,IAAI0B,IAChBD,EACAE,OAAOC,OAAO,CAAEC,IAAKC,IAAOC,iBAAkBC,SAAUT,GAAWF,IAE/DY,OAEFZ,EAAQa,SACVV,EAAOW,UAAUC,IAAI,mBACrBC,YAAWhB,EAAQa,QAASV,EAAOxB,cAAc,oBAGjDwB,EAAOW,UAAUG,OAAO,sBArC1BC,CAAqB,CACnBL,QAASf,EACTqB,SALkD,EAE5CA,SAINC,OAAkB,MANgC,EAElCA,OAKhBC,KAPkD,EAE1BA,UAQ5B/C,SAASC,iBAAiB,gCAAgCC,SAAQ,SAAC8C,GAAqB,IAAD,EACvCA,EAAG1C,QAAzCuC,EAD6E,EAC7EA,SAAUI,EADmE,EACnEA,YAAaC,EADsD,EACtDA,KAAMH,EADgD,EAChDA,KAC/Bb,EAAMC,IAAOC,iBACbe,EAASC,YAA0CJ,EAAIK,KAC7DrB,OAAOC,OAAOkB,EAAQ,CAAEN,WAAUI,cAAaC,OAAMhB,MAAKa,aAjB1DzB,IAAS,gBAAiB,SAAS,kBAAMgC,SAASrB,OAAOE,IAAOoB,yB,aClBrD,qBACbC,yBACArC,IAGApB","file":"js/14-0627b4c3a6b38b1e6e30.chunk.js","sourcesContent":["import tippy from 'tippy.js';\n\nexport function initDropdowns() {\n document.querySelectorAll('[data-dropdown]').forEach((i: HTMLElement) => {\n const template = document.querySelector(i.dataset.dropdown!) as HTMLDivElement;\n template.style.display = 'block';\n\n tippy(i, {\n appendTo: () => document.body,\n animation: 'shift-away',\n content: template,\n arrow: true,\n trigger: 'click',\n interactive: true,\n theme: 'light-border',\n });\n });\n}\n","import delegate from 'delegate';\nimport { fcMetadata } from '../fc_metadata';\nimport Routes from '../routes';\nimport transition from '../transition';\nimport { mountVueComponent } from '../vue';\nimport PhotoUpload, { PhotoInfo } from './photoUploadModal';\nimport AppPhotoUploadPreviews from './photoUploadPreviews.vue';\n\n//\n// Opens the PhotoUploadModal to allow users to upload several photos at once. This also\n// attaches the Vue component used for uploading photos within a
.\n//\n// It also contains logic for binding to the click event of all .photo-upload elements,\n// to make it easy to setup using .haml files, similarly to rec.ts and share.ts\n// Additional options can be passed along to the modal using data attributes\n//\n// add [data-attach-to] to indicate which parent record the photo should have (e.g. \"business#fresh-chalk-seattle\")\n// add [data-combine-with] to indicate the name of a text input that the component should appear inside of\n// add [data-name] to indicate the name of a hidden that will send data when a is submitted (e.g. \"conversation[photos]\")\n// add [data-url] to indicate which signing url to use\n// add [data-reload] if you want the page to reload after the user has uploaded photos\n//\n\nexport function initPhotoUploadModal() {\n // If the user is not logged in\n if (!fcMetadata.logged_in) {\n delegate('.photo-upload', 'click', () => location.assign(Routes.usersCreateAccount()));\n return;\n }\n delegate('.photo-upload', 'click', (e: MouseEvent) => {\n const $target = e.target as HTMLElement;\n const { attachTo, reload, type } = $target.dataset;\n openPhotoUploadModal({\n $source: $target,\n attachTo,\n reload: reload != null,\n type,\n });\n });\n document.querySelectorAll('.mount-photo-upload-previews').forEach(($i: HTMLElement) => {\n const { attachTo, combineWith, name, type } = $i.dataset;\n const url = Routes.signedPhotoUrl();\n const $model = mountVueComponent($i, AppPhotoUploadPreviews);\n Object.assign($model, { attachTo, combineWith, name, url, type });\n });\n}\n\ninterface Options {\n $source?: HTMLElement;\n attachTo?: string;\n reload?: boolean;\n type?: string;\n}\n\nexport function openPhotoUploadModal(options: Options = {}): Promise {\n return new Promise(resolve => {\n const $modal = document.querySelector('#photo-upload-modal') as HTMLElement;\n const $body = $modal.querySelector('.modal-body') as HTMLElement;\n const modal = new PhotoUpload(\n $body,\n Object.assign({ url: Routes.signedPhotoUrl(), callback: resolve }, options),\n );\n modal.show();\n // If this was opened from an element, animate from that\n if (options.$source) {\n $modal.classList.add('delayed-fade-in');\n transition(options.$source, $modal.querySelector('.modal-content') as HTMLElement);\n } else {\n // Otherwise use the micromodal default\n $modal.classList.remove('delayed-fade-in');\n }\n });\n}\n","// Anything in this file will be loaded lazily by the app.ts file. Put things\n// here that won't be needed immediately on page load that might need to load in\n// a lot of javascript.\n\nimport { initDropdowns } from './lib/dropdown';\nimport { initPhotoUploadModal } from './lib/photo_upload/photoUpload';\nimport { initRecModal } from './lib/rec/rec';\n\nexport default function() {\n initRecModal();\n initPhotoUploadModal();\n\n // Keep this last.\n initDropdowns();\n}\n"],"sourceRoot":""}