{"version":3,"file":"ajf-ionic-barcode.mjs","sources":["../../../projects/ionic/barcode/src/barcode.ts","../../../projects/ionic/barcode/src/barcode.html","../../../projects/ionic/barcode/src/barcode-module.ts","../../../projects/ionic/barcode/src/public_api.ts","../../../projects/ionic/barcode/src/ajf-ionic-barcode.ts"],"sourcesContent":["/**\n * @license\n * Copyright (C) Gnucoop soc. coop.\n *\n * This file is part of the Advanced JSON forms (ajf).\n *\n * Advanced JSON forms (ajf) is free software: you can redistribute it and/or\n * modify it under the terms of the GNU Affero General Public License as\n * published by the Free Software Foundation, either version 3 of the License,\n * or (at your option) any later version.\n *\n * Advanced JSON forms (ajf) is distributed in the hope that it will be useful,\n * but WITHOUT ANY WARRANTY; without even the implied warranty of\n * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU Affero\n * General Public License for more details.\n *\n * You should have received a copy of the GNU Affero General Public License\n * along with Advanced JSON forms (ajf).\n * If not, see http://www.gnu.org/licenses/.\n *\n */\n\nimport {AjfBarcode} from '@ajf/core/barcode';\nimport {\n  AfterViewInit,\n  ChangeDetectionStrategy,\n  ChangeDetectorRef,\n  Component,\n  forwardRef,\n  OnDestroy,\n  Renderer2,\n  ViewChild,\n  ViewEncapsulation,\n} from '@angular/core';\nimport {NG_VALUE_ACCESSOR} from '@angular/forms';\nimport {IonSlides} from '@ionic/angular';\nimport {Subscription} from 'rxjs';\n\nexport const BARCODE_CONTROL_VALUE_ACCESSOR: any = {\n  provide: NG_VALUE_ACCESSOR,\n  useExisting: forwardRef(() => AjfBarcodeComponent),\n  multi: true,\n};\n\n@Component({\n  selector: 'ajf-barcode',\n  templateUrl: 'barcode.html',\n  styleUrls: ['barcode.scss'],\n  encapsulation: ViewEncapsulation.None,\n  changeDetection: ChangeDetectionStrategy.OnPush,\n  providers: [BARCODE_CONTROL_VALUE_ACCESSOR],\n})\nexport class AjfBarcodeComponent extends AjfBarcode implements AfterViewInit, OnDestroy {\n  @ViewChild(IonSlides) slides!: IonSlides;\n\n  private _currentTab = 'image';\n  get currentTab(): string {\n    return this._currentTab;\n  }\n\n  private _slidesSub = Subscription.EMPTY;\n\n  constructor(cdr: ChangeDetectorRef, renderer: Renderer2) {\n    super(cdr, renderer);\n  }\n\n  ngAfterViewInit(): void {\n    this.initVideoStreams();\n    if (this.slides == null) {\n      return;\n    }\n    const slides = this.slides;\n    this._slidesSub = slides.ionSlideDidChange.subscribe(() => {\n      slides.getActiveIndex().then(idx => {\n        const currentTab = idx === 0 ? 'image' : 'camera';\n        if (this._currentTab !== currentTab) {\n          this._currentTab = currentTab;\n          this._cdr.markForCheck();\n        }\n      });\n    });\n  }\n\n  ngOnDestroy(): void {\n    this.stopCurrentStream();\n    this._slidesSub.unsubscribe();\n  }\n\n  selectTab(tab: 'image' | 'camera'): void {\n    const idx = tab === 'image' ? 0 : 1;\n    this._currentTab = tab;\n    this.onTabChange(idx);\n    if (this.slides != null) {\n      this.slides.slideTo(idx);\n    }\n    this._cdr.markForCheck();\n  }\n}\n","<ng-container *ngIf=\"value; else barcode\">\n  <div class=\"ajf-code-container\">\n    <span>{{ value }}</span>\n    <ion-button (click)=\"reset()\">\n      <ion-icon\n        slot=\"icon-only\"\n        style=\"transform: rotate(90deg)\"\n        name=\"barcode-outline\"\n      ></ion-icon>\n    </ion-button>\n  </div>\n</ng-container>\n<ng-template #barcode>\n  <ion-tabs>\n    <ion-tab-bar slot=\"top\">\n      <ion-tab-button [selected]=\"currentTab === 'image'\" (click)=\"selectTab('image')\">\n        <ion-label>{{ 'Image'| transloco }}</ion-label>\n      </ion-tab-button>\n      <ion-tab-button [selected]=\"currentTab === 'camera'\" (click)=\"selectTab('camera')\">\n        <ion-label>{{ 'Camera'| transloco }}</ion-label>\n      </ion-tab-button>\n    </ion-tab-bar>\n  </ion-tabs>\n  <ion-slides>\n    <ion-slide>\n      <div class=\"ajf-drop-container\">\n        <div class=\"ajf-dropzone\" ajfDnd (file)=\"onSelectDrop($event)\">\n          <div class=\"ajf-text-wrapper\">\n            <div class=\"ajf-centered\">\n              <a mat-button (click)=\"fileInput.click()\">{{'Drop your image here or click to select'|transloco}}</a>\n            </div>\n          </div>\n        </div>\n        <div #barcodeImagePreview class=\"ajf-barcode-image-preview\"></div>\n      </div>\n      <input\n        #fileInput\n        type=\"file\"\n        (change)=\"onSelectFile($event)\"\n        multiple\n        style=\"display: none\"\n      />\n    </ion-slide>\n    <ion-slide>\n      <div class=\"ajf-barcode-video\">\n        <ng-container *ngIf=\"supportsVideoStream; else noVideo\">\n          <div *ngIf=\"showSwitchButton\" class=\"ajf-barcode-switch-camera\">\n            <button mat-icon-button (click)=\"switchCamera()\"><ion-icon name=\"camera-reverse-outline\"></ion-icon></button>\n          </div>\n          <div #barcodeVideoPreview class=\"ajf-video-preview ajf-video-preview-hidden\">\n            <div *ngIf=\"value && value.length > 0\">{{ value }}</div>\n          </div>\n          <video #barcodeVideo autoplay playsinline muted></video>\n        </ng-container>\n        <ng-template #noVideo>\n\n        </ng-template>\n      </div>\n    </ion-slide>\n  </ion-slides>\n</ng-template>\n","/**\n * @license\n * Copyright (C) Gnucoop soc. coop.\n *\n * This file is part of the Advanced JSON forms (ajf).\n *\n * Advanced JSON forms (ajf) is free software: you can redistribute it and/or\n * modify it under the terms of the GNU Affero General Public License as\n * published by the Free Software Foundation, either version 3 of the License,\n * or (at your option) any later version.\n *\n * Advanced JSON forms (ajf) is distributed in the hope that it will be useful,\n * but WITHOUT ANY WARRANTY; without even the implied warranty of\n * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU Affero\n * General Public License for more details.\n *\n * You should have received a copy of the GNU Affero General Public License\n * along with Advanced JSON forms (ajf).\n * If not, see http://www.gnu.org/licenses/.\n *\n */\n\nimport {AjfCommonModule} from '@ajf/core/common';\nimport {AjfTranslocoModule} from '@ajf/core/transloco';\nimport {CommonModule} from '@angular/common';\nimport {NgModule} from '@angular/core';\nimport {IonicModule} from '@ionic/angular';\n\nimport {AjfBarcodeComponent} from './barcode';\n\n@NgModule({\n  imports: [AjfCommonModule, CommonModule, IonicModule, AjfTranslocoModule],\n  declarations: [AjfBarcodeComponent],\n  exports: [AjfBarcodeComponent],\n})\nexport class AjfBarcodeModule {}\n","/**\n * @license\n * Copyright (C) Gnucoop soc. coop.\n *\n * This file is part of the Advanced JSON forms (ajf).\n *\n * Advanced JSON forms (ajf) is free software: you can redistribute it and/or\n * modify it under the terms of the GNU Affero General Public License as\n * published by the Free Software Foundation, either version 3 of the License,\n * or (at your option) any later version.\n *\n * Advanced JSON forms (ajf) is distributed in the hope that it will be useful,\n * but WITHOUT ANY WARRANTY; without even the implied warranty of\n * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU Affero\n * General Public License for more details.\n *\n * You should have received a copy of the GNU Affero General Public License\n * along with Advanced JSON forms (ajf).\n * If not, see http://www.gnu.org/licenses/.\n *\n */\n\nexport * from './barcode-module';\nexport * from './barcode';\n","/**\n * Generated bundle index. Do not edit.\n */\n\nexport * from './public_api';\n"],"names":[],"mappings":";;;;;;;;;;;;;;AAAA;;;;;;;;;;;;;;;;;;;;AAoBG;AAkBU,MAAA,8BAA8B,GAAQ;AACjD,IAAA,OAAO,EAAE,iBAAiB;AAC1B,IAAA,WAAW,EAAE,UAAU,CAAC,MAAM,mBAAmB,CAAC;AAClD,IAAA,KAAK,EAAE,IAAI;EACX;AAUI,MAAO,mBAAoB,SAAQ,UAAU,CAAA;IAUjD,WAAY,CAAA,GAAsB,EAAE,QAAmB,EAAA;AACrD,QAAA,KAAK,CAAC,GAAG,EAAE,QAAQ,CAAC,CAAC;QARf,IAAW,CAAA,WAAA,GAAG,OAAO,CAAC;AAKtB,QAAA,IAAA,CAAA,UAAU,GAAG,YAAY,CAAC,KAAK,CAAC;KAIvC;AARD,IAAA,IAAI,UAAU,GAAA;QACZ,OAAO,IAAI,CAAC,WAAW,CAAC;KACzB;IAQD,eAAe,GAAA;QACb,IAAI,CAAC,gBAAgB,EAAE,CAAC;AACxB,QAAA,IAAI,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